finished finding images by timestamp

This commit is contained in:
Hendrik Schutter 2019-02-22 11:49:40 +01:00
parent 0627b40f9b
commit 0d4c2825f6
3 changed files with 43 additions and 40 deletions

View File

@ -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 -log -m createDB -r /home/hendrik/Schreibtisch/Geiger_Timelaspe/Rohdaten/ -p /home/hendrik/Schreibtisch/Post_Sort/-i time -n 10
19711 197011

View File

@ -17,55 +17,63 @@ public class ImageFinderTimestamp extends ImageFinder
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
static int sortedimagecounter = 0; static int filesindex;
static int fileslenght = 0; static int fileslenght;
static File[] files = null; static File[] files = null;
private static void sortImages() private static void sortImages()
{ {
// System.out.println("Path: " + rootFolder + years[i] + "/" for (int i = currentYear; i < years.length; i++) {
// + monthNames[j] + "/" ); if (years[i] != null) {
/*
* File dir = new File( rootFolder + years[i] + "/" + monthNames[j] +
* "/");
*/
File dir = new File(rootFolder + "/");
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.out.println("File lenght: " + fileslenght);
System.exit(0);
sortFilesByDateCreated(files); sortFilesByDateCreated(files);
sortedimagecounter = 0; filesindex = 0;
/* currentMonth = j + 1;
* for (int k = 0; k < files.length; k++) { currentYear = i;
* System.out.println(files[k].getName()); } return;
*/ }
}
currentMonth = 0;
}
}
} }
public String getImagePath(int imageCounter) public String getImagePath(int imageCounter)
{ {
String path = null; String path = null;
// System.out.println("filesindex: " + filesindex);
// System.out.println("fileslenght: " + fileslenght);
if (sortedimagecounter != (fileslenght - 1)) { if ((filesindex < fileslenght) && (fileslenght != 0)) {
System.out.println("sort new Images"); path = files[filesindex].getAbsolutePath();
sortImages(); filesindex++;
path = files[sortedimagecounter].getAbsolutePath();
sortedimagecounter++;
return path; return path;
} else { } else {
path = files[sortedimagecounter].getAbsolutePath(); // System.out.println("sort new Images");
sortedimagecounter++; sortImages();
if (filesindex >= fileslenght) {
return "404";
}
path = files[filesindex].getAbsolutePath();
filesindex++;
return path; return path;
} }

View File

@ -28,9 +28,9 @@ public class Main
{ {
ImageFinder imgF = null; ImageFinder imgF = null;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
//System.out.println(i + ": " +args[i]); // System.out.println(i + ": " +args[i]);
String value = args[i]; String value = args[i];
@ -69,7 +69,6 @@ public class Main
System.out.println("[outputPath] " + outputPath); System.out.println("[outputPath] " + outputPath);
} }
if (value.equals("-i")) { if (value.equals("-i")) {
i++; i++;
@ -82,15 +81,13 @@ public class Main
} }
} }
if (value.equals("-n")) { if (value.equals("-n")) {
i++; i++;
maxImgageCounter = Integer.parseInt(args[i]); maxImgageCounter = Integer.parseInt(args[i]);
System.out.println("[maxImgageCounter] " + maxImgageCounter); System.out.println("[maxImgageCounter] " + maxImgageCounter);
} }
if (value.equals("-help")) { if (value.equals("-help")) {
System.out.println( System.out.println(
"-log -m createDB -r /home/hendrik/FTP/camera01/ -p /home/hendrik/Schreibtisch/ -o /home/hendrik/Schreibtisch/testeritis/ -n 83584"); "-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) { if (modi) {
long timeStart; long timeStart;
@ -125,8 +119,8 @@ public class Main
timeStart = System.currentTimeMillis(); timeStart = System.currentTimeMillis();
System.out.println("Suche ..."); System.out.println("Suche ...");
//System.exit(1); // System.exit(1);
try { try {
PrintWriter missingTxt = new PrintWriter( PrintWriter missingTxt = new PrintWriter(
projectPath + "missingImages.txt"); projectPath + "missingImages.txt");
@ -141,7 +135,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);