1
0
mirror of https://github.com/ciromattia/kcc synced 2026-05-30 11:13:15 +00:00

Preparing the field for switching towards a full-fledged app (get rid of AppleScript) via py2app/py2exe

This commit is contained in:
Ciro Mattia Gonano
2012-12-09 12:37:25 +01:00
parent 8fdcc7e886
commit 4d96eb346f
19 changed files with 2403 additions and 11 deletions
+5 -5
View File
@@ -24,15 +24,15 @@
<key>CFBundleExecutable</key>
<string>droplet</string>
<key>CFBundleGetInfoString</key>
<string>KindleComicConverter 1.0, Written 2012 by Ciro Mattia Gonano</string>
<string>KindleComicConverter 2.0, Written 2012 by Ciro Mattia Gonano</string>
<key>CFBundleIconFile</key>
<string>droplet</string>
<key>CFBundleIdentifier</key>
<string>com.apple.ScriptEditor.id.5D4EC602-9033-4D02-AF60-6380F83B0145</string>
<string>com.github.ciromattia.kcc</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>KindleComicConverter 1.0</string>
<string>KindleComicConverter 1.20</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@@ -57,9 +57,9 @@
<key>positionOfDivider</key>
<real>568</real>
<key>savedFrame</key>
<string>144 338 889 690 0 0 1680 1028 </string>
<string>188 368 889 690 0 0 1920 1058 </string>
<key>selectedTabView</key>
<string>result</string>
<string>event log</string>
</dict>
</dict>
</plist>
@@ -56,6 +56,7 @@ class CBxArchive:
import rarfile
except ImportError:
self.cbrFile = None
return
cbrFile = rarfile.RarFile(self.origFileName)
for f in cbrFile.namelist():
if (f.startswith('__MACOSX') or f.endswith('.DS_Store')):
@@ -35,7 +35,7 @@ __version__ = '1.20'
import os
import sys
import cbxarchive
import image, cbxarchive
class HTMLbuilder:
@@ -153,7 +153,6 @@ if __name__ == "__main__":
title = "comic"
filelist = []
try:
import image
print "Splitting double pages..."
for file in os.listdir(dir):
if (getImageFileName(file) != None):
@@ -164,7 +163,7 @@ if __name__ == "__main__":
print "Optimizing " + file + " for " + profile
img = image.ComicPage(dir+'/'+file, profile)
img.resizeImage()
img.frameImage()
#img.frameImage()
img.quantizeImage()
img.saveToDir(dir)
except ImportError:
@@ -172,9 +171,15 @@ if __name__ == "__main__":
for file in os.listdir(dir):
if (getImageFileName(file) != None and isInFilelist(file,filelist) == False):
# put credits at the end
if "credits" in file.lower():
os.rename(dir+'/'+file, dir+'/ZZZ999_'+file)
file = 'ZZZ999_'+file
filename = HTMLbuilder(dir,file).getResult()
if (filename != None):
filelist.append(filename)
NCXbuilder(dir,title)
# ensure we're sorting files alphabetically
filelist = sorted(filelist, key=lambda name: name[0])
OPFBuilder(dir,title,filelist)
sys.exit(0)