Commit b48dede2 authored by ludwig's avatar ludwig

added possibility to choose the target path for the ocr-input folder


git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@97 0463f305-d864-43cb-8a47-61cf597d4139
parent c028f8b1
......@@ -647,6 +647,16 @@ public class Index {
// thumbnails
// //////////////////////////////////////////////////////////////////
ScriptCreator scriptCreator;
public boolean computeScreenshots(int mode, boolean batch, boolean ShowProgressMonitor, String ocrPath){
try {
scriptCreator = new ScriptCreator(recording, mode, ocrPath);
return computeScreenshots(mode, batch, ShowProgressMonitor);
} catch (IOException e) {
return false;
}
}
public boolean computeScreenshots(int mode, boolean batch, boolean ShowProgressMonitor) throws IOException {
......@@ -688,7 +698,8 @@ public class Index {
recording.pause();
int previousTime = recording.getTime();
ScriptCreator scriptCreator = new ScriptCreator(recording, mode);
if(scriptCreator != null)
scriptCreator = new ScriptCreator(recording, mode);
PDFHelper pdfHelper = null;
if ((mode & ScriptCreator.PDF_SCRIPT) != 0) {
......
......@@ -87,6 +87,33 @@ public class ScriptCreator {
}
}
public ScriptCreator(Recording recording, int mode, String ocrPath) throws IOException {
this.recording = recording;
// create directory for html index
boolean generate_script = true;
String directory = recording.getDirectory();
file_base = recording.getFileBase();
ocr_path = ocrPath;//directory + file_base + ".ocr";
if ((mode & OCR_OPTIMIZED) != 0)
generate_script &= createDirectory(ocr_path);
index_file_base = directory + file_base + ".html";
if ((mode & HTML_SCRIPT) != 0) {
generate_script &= createDirectory(index_file_base);
generate_script &= createDirectory(index_file_base + File.separator + "thumbs");
generate_script &= createDirectory(index_file_base + File.separator + "html");
generate_script &= createDirectory(index_file_base + File.separator + "images");
if (generate_script) {
writeMainIndexAndThumbnailOverview();
} else {
System.out.println("\nERROR: Script generation failed. Could not create directories.\n");
}
}
}
public static void main(String[] args) throws IOException {
if (args.length == 0)
usage();
......
......@@ -983,6 +983,10 @@ public void setExtensions(ArrayList<byte[]> ext){
}
public boolean createScript(final int mode, boolean batch, String ocrPath) throws IOException {
return index.computeScreenshots(mode, batch, true, ocrPath);
}
public boolean createScript(final int mode, boolean batch, boolean ShowProgressMonitor) throws IOException {
return index.computeScreenshots(mode, batch, ShowProgressMonitor);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment