forked from CopterSicht/TLC_Post_Server
		
	moved to maven project
This commit is contained in:
		
							
								
								
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -23,3 +23,10 @@ | |||||||
| # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||||||
| hs_err_pid* | hs_err_pid* | ||||||
|  |  | ||||||
|  | target/ | ||||||
|  | .settings/ | ||||||
|  | .project | ||||||
|  | .classpath | ||||||
|  | ..gitignore.kate-swp | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										99
									
								
								pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,99 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  |  | ||||||
|  | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||||
|  |   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||
|  |   <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
|  |   <groupId>com.hendrikschutter</groupId> | ||||||
|  |   <artifactId>tlc_post</artifactId> | ||||||
|  |   <version>0.0.1-SNAPSHOT</version> | ||||||
|  |  | ||||||
|  |   <name>tlc_post</name> | ||||||
|  |   <!-- FIXME change it to the project's website --> | ||||||
|  |   <url>http://www.example.com</url> | ||||||
|  |  | ||||||
|  |   <properties> | ||||||
|  |     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||||||
|  |     <maven.compiler.source>1.7</maven.compiler.source> | ||||||
|  |     <maven.compiler.target>1.7</maven.compiler.target> | ||||||
|  |   </properties> | ||||||
|  |  | ||||||
|  |   <dependencies> | ||||||
|  |     <dependency> | ||||||
|  |       <groupId>junit</groupId> | ||||||
|  |       <artifactId>junit</artifactId> | ||||||
|  |       <version>4.11</version> | ||||||
|  |       <scope>test</scope> | ||||||
|  |     </dependency> | ||||||
|  |     <dependency> | ||||||
|  |     <groupId>commons-io</groupId> | ||||||
|  |     <artifactId>commons-io</artifactId> | ||||||
|  |     <version>2.11.0</version> | ||||||
|  | </dependency> | ||||||
|  | <dependency> | ||||||
|  |     <groupId>com.drewnoakes</groupId> | ||||||
|  |     <artifactId>metadata-extractor</artifactId> | ||||||
|  |     <version>2.6.2</version> | ||||||
|  | </dependency> | ||||||
|  | <dependency> | ||||||
|  |     <groupId>org.xerial</groupId> | ||||||
|  |     <artifactId>sqlite-jdbc</artifactId> | ||||||
|  |     <version>3.36.0.3</version> | ||||||
|  | </dependency> | ||||||
|  |   </dependencies> | ||||||
|  |  | ||||||
|  |   <build> | ||||||
|  |   <plugins> | ||||||
|  | 			<plugin> | ||||||
|  | 				<groupId>org.apache.maven.plugins</groupId> | ||||||
|  | 				<artifactId>maven-compiler-plugin</artifactId> | ||||||
|  | 				<version>3.8.1</version> | ||||||
|  | 				<configuration> | ||||||
|  | 					<source>11</source> | ||||||
|  | 					<target>11</target> | ||||||
|  | 					<!--<release>11</release> --> | ||||||
|  | 					<showWarnings>true</showWarnings> | ||||||
|  | 					<showDeprecation>true</showDeprecation> | ||||||
|  | 				</configuration> | ||||||
|  | 			</plugin> | ||||||
|  | 			<plugin> | ||||||
|  | 				<groupId>org.codehaus.mojo</groupId> | ||||||
|  | 				<artifactId>exec-maven-plugin</artifactId> | ||||||
|  | 				<version>3.0.0</version> | ||||||
|  | 				<executions> | ||||||
|  | 					<execution> | ||||||
|  | 						<goals> | ||||||
|  | 							<goal>java</goal> | ||||||
|  | 						</goals> | ||||||
|  | 					</execution> | ||||||
|  | 				</executions> | ||||||
|  | 				<configuration> | ||||||
|  | 					<mainClass>com.hendrikschutter.tlc_post.Main</mainClass> | ||||||
|  | 				</configuration> | ||||||
|  | 			</plugin> | ||||||
|  | 			<plugin> | ||||||
|  | 				<groupId>org.apache.maven.plugins</groupId> | ||||||
|  | 				<artifactId>maven-shade-plugin</artifactId> | ||||||
|  | 				<version>3.2.2</version> | ||||||
|  | 				<configuration> | ||||||
|  | 					<finalName>TLC_Post</finalName> | ||||||
|  | 					<shadedArtifactAttached>true</shadedArtifactAttached> | ||||||
|  | 					<transformers> | ||||||
|  | 						<transformer | ||||||
|  | 							implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||||||
|  | 							<mainClass>com.hendrikschutter.tlc_post.Main</mainClass> | ||||||
|  | 						</transformer> | ||||||
|  | 					</transformers> | ||||||
|  | 				</configuration> | ||||||
|  | 				<executions> | ||||||
|  | 					<execution> | ||||||
|  | 						<phase>package</phase> | ||||||
|  | 						<goals> | ||||||
|  | 							<goal>shade</goal> | ||||||
|  | 						</goals> | ||||||
|  | 					</execution> | ||||||
|  | 				</executions> | ||||||
|  | 			</plugin> | ||||||
|  | 		</plugins> | ||||||
|  |   </build> | ||||||
|  | </project> | ||||||
| @ -1,3 +1,4 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
| 
 | 
 | ||||||
| import java.sql.Connection; | import java.sql.Connection; | ||||||
| import java.sql.DriverManager; | import java.sql.DriverManager; | ||||||
| @ -1,3 +1,5 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.util.Calendar; | import java.util.Calendar; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| @ -1,3 +1,4 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
| 
 | 
 | ||||||
| import com.drew.imaging.ImageMetadataReader; | import com.drew.imaging.ImageMetadataReader; | ||||||
| import com.drew.imaging.ImageProcessingException; | import com.drew.imaging.ImageProcessingException; | ||||||
| @ -20,8 +21,7 @@ public class Exif | |||||||
| 		Calendar calendar = Calendar.getInstance(); | 		Calendar calendar = Calendar.getInstance(); | ||||||
| 		try { | 		try { | ||||||
| 			Metadata metadata = ImageMetadataReader.readMetadata(file); | 			Metadata metadata = ImageMetadataReader.readMetadata(file); | ||||||
| 			ExifSubIFDDirectory directory = metadata | 			ExifSubIFDDirectory directory = metadata.getDirectory(ExifSubIFDDirectory.class); | ||||||
| 					.getFirstDirectoryOfType(ExifSubIFDDirectory.class); |  | ||||||
| 			date = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL); | 			date = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL); | ||||||
| 			ZonedDateTime cetTimeZoned = ZonedDateTime.of( | 			ZonedDateTime cetTimeZoned = ZonedDateTime.of( | ||||||
| 					new java.sql.Timestamp(date.getTime()).toLocalDateTime(), | 					new java.sql.Timestamp(date.getTime()).toLocalDateTime(), | ||||||
| @ -1,3 +1,4 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
| 
 | 
 | ||||||
| public class Image | public class Image | ||||||
| { | { | ||||||
| @ -1,3 +1,4 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
| 
 | 
 | ||||||
| import java.nio.file.Files; | import java.nio.file.Files; | ||||||
| import java.nio.file.Paths; | import java.nio.file.Paths; | ||||||
| @ -15,9 +16,12 @@ public abstract class ImageFinder | |||||||
| 
 | 
 | ||||||
| 	static int currentMonth = 0; | 	static int currentMonth = 0; | ||||||
| 
 | 
 | ||||||
| 	static String[] monthNames = { "01_January", "02_February", "03_March", "04_April", | 	// static String[] monthNames = { "01_January", "02_February", "03_March", | ||||||
| 			"05_May", "06_June", "07_July", "08_August", "09_September", | 	// "04_April", "05_May", "06_June", "07_July", "08_August", "09_September", | ||||||
| 			"10_October", "11_November", "12_December" }; | 	// "10_October", "11_November", "12_December" }; | ||||||
|  | 
 | ||||||
|  | 	static String[] monthNames = { "01", "02", "03", "04", "05", "06", "07", | ||||||
|  | 			"08", "09", "10", "11", "12" }; | ||||||
| 
 | 
 | ||||||
| 	static Boolean[][] month = new Boolean[maxYears][12]; | 	static Boolean[][] month = new Boolean[maxYears][12]; | ||||||
| 
 | 
 | ||||||
| @ -32,7 +36,7 @@ public abstract class ImageFinder | |||||||
| 	String findStartyear() | 	String findStartyear() | ||||||
| 	{ | 	{ | ||||||
| 		boolean next = true; | 		boolean next = true; | ||||||
| 		int i = 0; // start year | 		int i = 2020; // start year | ||||||
| 		while (next) { | 		while (next) { | ||||||
| 			int currentyear = i; | 			int currentyear = i; | ||||||
| 			if (Files.isDirectory(Paths.get(rootFolder + currentyear + "/"))) { | 			if (Files.isDirectory(Paths.get(rootFolder + currentyear + "/"))) { | ||||||
| @ -1,3 +1,5 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.FileFilter; | import java.io.FileFilter; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| @ -1,3 +1,7 @@ | |||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.FileFilter; | import java.io.FileFilter; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| @ -57,15 +61,15 @@ public class ImageFinderTimestamp extends ImageFinder | |||||||
| 	public String getImagePath(int imageCounter) | 	public String getImagePath(int imageCounter) | ||||||
| 	{ | 	{ | ||||||
| 		String path = null; | 		String path = null; | ||||||
| 		// System.out.println("filesindex: " + filesindex); | 		 System.out.println("filesindex: " + filesindex); | ||||||
| 		// System.out.println("fileslenght: " + fileslenght); | 		 System.out.println("fileslenght: " + fileslenght); | ||||||
| 
 | 
 | ||||||
| 		if ((filesindex < fileslenght) && (fileslenght != 0)) { | 		if ((filesindex < fileslenght) && (fileslenght != 0)) { | ||||||
| 			path = files[filesindex].getAbsolutePath(); | 			path = files[filesindex].getAbsolutePath(); | ||||||
| 			filesindex++; | 			filesindex++; | ||||||
| 			return path.substring(lengthRootFolder); | 			return path.substring(lengthRootFolder); | ||||||
| 		} else { | 		} else { | ||||||
| 			// System.out.println("sort new Images"); | 			 System.out.println("sort new Images"); | ||||||
| 			sortImages(); | 			sortImages(); | ||||||
| 
 | 
 | ||||||
| 			if (filesindex >= fileslenght) { | 			if (filesindex >= fileslenght) { | ||||||
| @ -1,10 +1,10 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.FileNotFoundException; | import java.io.FileNotFoundException; | ||||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||||
| import java.util.Calendar; | import java.util.Calendar; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| public class Main | public class Main | ||||||
| { | { | ||||||
| 	// read from UI later | 	// read from UI later | ||||||
| @ -123,6 +123,8 @@ public class Main | |||||||
| 			String startyear = imgF.findStartyear(); | 			String startyear = imgF.findStartyear(); | ||||||
| 			int yearCount = Integer.parseInt(startyear); | 			int yearCount = Integer.parseInt(startyear); | ||||||
| 
 | 
 | ||||||
|  | 			System.out.println(yearCount); | ||||||
|  | 
 | ||||||
| 			imgF.findYears(yearCount, startyear); | 			imgF.findYears(yearCount, startyear); | ||||||
| 			imgF.findMonths(yearCount); | 			imgF.findMonths(yearCount); | ||||||
| 
 | 
 | ||||||
| @ -149,7 +151,7 @@ public class Main | |||||||
| 						System.out.println("%"); | 						System.out.println("%"); | ||||||
| 					} | 					} | ||||||
| 					String path = imgF.getImagePath(i); | 					String path = imgF.getImagePath(i); | ||||||
| 					// System.out.println(i + " Path: " + path); | 					 System.out.println(i + " Path: " + path); | ||||||
| 					if (path != "404") { | 					if (path != "404") { | ||||||
| 						// gefunden | 						// gefunden | ||||||
| 						File f = new File(rootFolderPath + path); | 						File f = new File(rootFolderPath + path); | ||||||
| @ -172,6 +174,8 @@ public class Main | |||||||
| 						// nicht gefunden | 						// nicht gefunden | ||||||
| 						System.out.println("Nicht gefunden: " + i); | 						System.out.println("Nicht gefunden: " + i); | ||||||
| 						missingTxt.println(i); | 						missingTxt.println(i); | ||||||
|  | 						 | ||||||
|  | 						break; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				missingTxt.close(); | 				missingTxt.close(); | ||||||
| @ -1,3 +1,5 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.nio.file.Files; | import java.nio.file.Files; | ||||||
| @ -1,3 +1,5 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  | 
 | ||||||
| import java.util.Calendar; | import java.util.Calendar; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
							
								
								
									
										20
									
								
								src/test/java/com/hendrikschutter/tlc_post/AppTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/test/java/com/hendrikschutter/tlc_post/AppTest.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | |||||||
|  | package com.hendrikschutter.tlc_post; | ||||||
|  |  | ||||||
|  | import static org.junit.Assert.assertTrue; | ||||||
|  |  | ||||||
|  | import org.junit.Test; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Unit test for simple App. | ||||||
|  |  */ | ||||||
|  | public class AppTest  | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Rigorous Test :-) | ||||||
|  |      */ | ||||||
|  |     @Test | ||||||
|  |     public void shouldAnswerWithTrue() | ||||||
|  |     { | ||||||
|  |         assertTrue( true ); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user