diff --git a/Server_TLC_PostSW.txt b/Server_TLC_PostSW.txt index 911eecd..f40b1e0 100644 --- a/Server_TLC_PostSW.txt +++ b/Server_TLC_PostSW.txt @@ -25,4 +25,5 @@ done -log -m createDB -r /home/hendrik/Schreibtisch/Geiger_Timelaspe/Rohdaten/ -p /home/hendrik/Schreibtisch/Post_Sort/-i time -n 10 -19711 +197011 + diff --git a/src/ImageFinderTimestamp.java b/src/ImageFinderTimestamp.java index 67ad7d8..50f1716 100644 --- a/src/ImageFinderTimestamp.java +++ b/src/ImageFinderTimestamp.java @@ -17,55 +17,63 @@ public class ImageFinderTimestamp extends ImageFinder // TODO Auto-generated constructor stub } - static int sortedimagecounter = 0; + static int filesindex; - static int fileslenght = 0; + static int fileslenght; static File[] files = null; private static void sortImages() { - // System.out.println("Path: " + rootFolder + years[i] + "/" - // + monthNames[j] + "/" ); - /* - * File dir = new File( rootFolder + years[i] + "/" + monthNames[j] + - * "/"); - */ - File dir = new File(rootFolder + "/"); + for (int i = currentYear; i < years.length; i++) { + if (years[i] != null) { - files = dir.listFiles(); + for (int j = currentMonth; j < month[i].length; j++) { + if (month[i][j]) { + File dir = new File( + rootFolder + years[i] + "/" + monthNames[j] + "/"); - fileslenght = files.length; + files = dir.listFiles(); + fileslenght = files.length; - System.out.println("File lenght: " + fileslenght); - - System.exit(0); + // System.out.println("File lenght: " + fileslenght); - sortFilesByDateCreated(files); + sortFilesByDateCreated(files); - sortedimagecounter = 0; + filesindex = 0; - /* - * for (int k = 0; k < files.length; k++) { - * System.out.println(files[k].getName()); } - */ + currentMonth = j + 1; + currentYear = i; + return; + } + } + currentMonth = 0; + } + } } public String getImagePath(int imageCounter) { String path = null; + // System.out.println("filesindex: " + filesindex); + // System.out.println("fileslenght: " + fileslenght); - if (sortedimagecounter != (fileslenght - 1)) { - System.out.println("sort new Images"); - sortImages(); - path = files[sortedimagecounter].getAbsolutePath(); - sortedimagecounter++; + if ((filesindex < fileslenght) && (fileslenght != 0)) { + path = files[filesindex].getAbsolutePath(); + filesindex++; return path; } else { - path = files[sortedimagecounter].getAbsolutePath(); - sortedimagecounter++; + // System.out.println("sort new Images"); + sortImages(); + + if (filesindex >= fileslenght) { + return "404"; + } + + path = files[filesindex].getAbsolutePath(); + filesindex++; return path; } diff --git a/src/Main.java b/src/Main.java index 5473bfd..4d0cf09 100644 --- a/src/Main.java +++ b/src/Main.java @@ -28,9 +28,9 @@ public class Main { ImageFinder imgF = null; - + for (int i = 0; i < args.length; i++) { - //System.out.println(i + ": " +args[i]); + // System.out.println(i + ": " +args[i]); String value = args[i]; @@ -69,7 +69,6 @@ public class Main System.out.println("[outputPath] " + outputPath); } - if (value.equals("-i")) { i++; @@ -82,15 +81,13 @@ public class Main } } - + if (value.equals("-n")) { i++; maxImgageCounter = Integer.parseInt(args[i]); System.out.println("[maxImgageCounter] " + maxImgageCounter); } - - if (value.equals("-help")) { System.out.println( "-log -m createDB -r /home/hendrik/FTP/camera01/ -p /home/hendrik/Schreibtisch/ -o /home/hendrik/Schreibtisch/testeritis/ -n 83584"); @@ -100,9 +97,6 @@ public class Main } - - - if (modi) { long timeStart; @@ -125,8 +119,8 @@ public class Main timeStart = System.currentTimeMillis(); System.out.println("Suche ..."); - //System.exit(1); - + // System.exit(1); + try { PrintWriter missingTxt = new PrintWriter( projectPath + "missingImages.txt"); @@ -141,7 +135,7 @@ public class Main System.out.println("%"); } String path = imgF.getImagePath(i); - System.out.println(i + " Path: " + path); + // System.out.println(i + " Path: " + path); if (path != "404") { // gefunden File f = new File(rootFolderPath + path);