Commits

Scott Bennett-McLeish  committed 6fd08d6

Updated to work nicer with more than one Pc.

  • Participants
  • Parent commits 775a84b

Comments (0)

Files changed (7)

 temp
 lib
 images
-ebookwall.htm
+ebookwall.htm
+ebookwall-workpc.htm

File com/thecuriousdev/ebookwall/EBookWall.groovy

 	private def imagesDir
 	private def config
 	
-	public EBookWall() {
-		config = loadConfig("config.properties")
+	public EBookWall(String configFile) {
+		config = loadConfig(configFile)
 		
 		outFile = config.out_file
 		
 				
 				//println e.path
 				if (checkWanted(f.getAbsolutePath(), excludeDirs)) {
+					println "Added file: ${e.name} to include list"
 					files.add(e)
 				}
 			}
 		files.each { f ->
 			if (f.name.toLowerCase().endsWith(".pdf")) {
 				println "Processing ${f.path}"
-				File img = PdfImageCreator.createImageFromFileWithPDFBox(f.file, imagesDir, true)
-				//println "img = ${img?.getCanonicalPath()}"
+				File img = PdfImageCreator.createImageFromFileWithPDFBox(f.file, imagesDir, false)
 				def imgPath = img?.getCanonicalPath()?.replaceAll("\\\\", "/")
-				//println "imgPath = ${imgPath}"
 				
 				if (i%rowMax==1) {
 					sb << "<tr>\n"
 	}
 	
 	boolean checkWanted(String path, List excludeDirs) {
-		//println path
+		println path
+		boolean wanted = true
 		excludeDirs.each  { d ->
-			//println d
 			def dir = d.replaceAll("/", "\\\\")
 			//println "path:${path} <==> excludeDir: ${dir}"
 			if (path.contains(dir)) {
-				//println "found a file within an exclude dir, so we'll reject this one"
-				return false
+				wanted = false
 			}	
 		}
 		
-		//println "didn't find the file within an exclude dir"
-		return true
+		println "checkWanted: returning wanted = ${wanted}"
+		return wanted
 	}
 	
 	Properties loadConfig(def filename) {
 	}
 	
 	static main(args) {
-		new EBookWall()
+		if (args.length > 0) {
+			new EBookWall(args[0])
+		}
+		else {
+			new EBookWall("config.properties")
+		}
 	}
 }

File com/thecuriousdev/ebookwall/PdfImageCreator.groovy

 				}
 				
 				if (!success) {
-					println "There was some kind of problem..."
+					println "There was some kind of problem... ${outImageFile.name}"
 				}
 				else {
 					//println "wrote image for ${file.getCanonicalPath()}"

File config-workPc.properties

+images_dir=C:/Documents and Settings/benns95/Dropbox/EbookWall/images/
+out_file=C:/Documents and Settings/benns95/Dropbox/EbookWall/ebookwall-workpc.htm
+include_dirs=C:/Documents and Settings/benns95/Dropbox/current_reading_ebooks/|C:/Documents and Settings/benns95/Dropbox/RegularReading/
+exclude_dirs=C:/Documents and Settings/benns95/Dropbox/RegularReading/_archive/|C:/Documents and Settings/benns95/Dropbox/current_reading_ebooks/_archive/

File config.properties

 images_dir=C:/Users/Scott/Dropbox/EbookWall/images/
 out_file=C:/Users/Scott/Dropbox/EbookWall/ebookwall.htm
 include_dirs=C:/Users/Scott/Dropbox/current_reading_ebooks|C:/Users/Scott/Dropbox/RegularReading/
-exclude_dirs=C:/Users/Scott/Dropbox/RegularReading/_archive/|C:/Users/Scott/Dropbox/current_reading_ebooks/_unwanted/
+exclude_dirs=C:/Users/Scott/Dropbox/RegularReading/_archive/|C:/Users/Scott/Dropbox/current_reading_ebooks/_archive/

File run-workPc.bat

+%GROOVY_HOME%/bin/groovy -Dhttp.proxyHost=10.17.236.44 -Dhttp.proxyPort=8080 com\thecuriousdev\ebookwall\EBookWall.groovy config-workPc.properties
-%GROOVY_HOME%/bin/groovy com\thecuriousdev\ebookwall\EBookWall.groovy
+%GROOVY_HOME%/bin/groovy com\thecuriousdev\ebookwall\EBookWall.groovy config.properties