mirror of
https://github.com/ciromattia/kcc
synced 2025-12-20 13:11:47 +00:00
Fix for hardcoded kindlegen HD path.
This commit is contained in:
@@ -57,7 +57,7 @@
|
|||||||
<key>positionOfDivider</key>
|
<key>positionOfDivider</key>
|
||||||
<real>568</real>
|
<real>568</real>
|
||||||
<key>savedFrame</key>
|
<key>savedFrame</key>
|
||||||
<string>188 368 889 690 0 0 1920 1058 </string>
|
<string>666 338 889 690 0 0 1680 1028 </string>
|
||||||
<key>selectedTabView</key>
|
<key>selectedTabView</key>
|
||||||
<string>event log</string>
|
<string>event log</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Binary file not shown.
@@ -130,56 +130,67 @@ def isInFilelist(file,list):
|
|||||||
seen = True
|
seen = True
|
||||||
return seen
|
return seen
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def Copyright():
|
||||||
print ('comic2ebook v%(__version__)s. '
|
print ('comic2ebook v%(__version__)s. '
|
||||||
'Written 2012 by Ciro Mattia Gonano.' % globals())
|
'Written 2012 by Ciro Mattia Gonano.' % globals())
|
||||||
|
|
||||||
|
def Usage():
|
||||||
|
print "Generates HTML, NCX and OPF for a Comic ebook from a bunch of images"
|
||||||
|
print "Optimized for creating Mobipockets to be read into Kindle Paperwhite"
|
||||||
|
print "Usage:"
|
||||||
|
print " %s <profile> <dir> <title>" % sys.argv[0]
|
||||||
|
print " <title> is optional"
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv
|
||||||
|
profile = argv[1]
|
||||||
|
dir = argv[2]
|
||||||
|
cbx = cbxarchive.CBxArchive(dir)
|
||||||
|
if cbx.isCbxFile():
|
||||||
|
cbx.extract()
|
||||||
|
dir = cbx.getPath()
|
||||||
|
if len(argv)==4:
|
||||||
|
title = argv[3]
|
||||||
|
else:
|
||||||
|
title = "comic"
|
||||||
|
filelist = []
|
||||||
|
try:
|
||||||
|
print "Splitting double pages..."
|
||||||
|
for file in os.listdir(dir):
|
||||||
|
if (getImageFileName(file) != None):
|
||||||
|
img = image.ComicPage(dir+'/'+file, profile)
|
||||||
|
img.splitPage(dir)
|
||||||
|
for file in os.listdir(dir):
|
||||||
|
if (getImageFileName(file) != None):
|
||||||
|
print "Optimizing " + file + " for " + profile
|
||||||
|
img = image.ComicPage(dir+'/'+file, profile)
|
||||||
|
img.resizeImage()
|
||||||
|
#img.frameImage()
|
||||||
|
img.quantizeImage()
|
||||||
|
img.saveToDir(dir)
|
||||||
|
except ImportError:
|
||||||
|
print "Could not load PIL, not optimizing image"
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
Copyright()
|
||||||
if len(sys.argv)<3 or len(sys.argv)>4:
|
if len(sys.argv)<3 or len(sys.argv)>4:
|
||||||
print "Generates HTML, NCX and OPF for a Comic ebook from a bunch of images"
|
Usage()
|
||||||
print "Optimized for creating Mobipockets to be read into Kindle Paperwhite"
|
|
||||||
print "Usage:"
|
|
||||||
print " %s <profile> <dir> <title>" % sys.argv[0]
|
|
||||||
print " <title> is optional"
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
profile = sys.argv[1]
|
main()
|
||||||
dir = sys.argv[2]
|
|
||||||
cbx = cbxarchive.CBxArchive(dir)
|
|
||||||
if cbx.isCbxFile():
|
|
||||||
cbx.extract()
|
|
||||||
dir = cbx.getPath()
|
|
||||||
if len(sys.argv)==4:
|
|
||||||
title = sys.argv[3]
|
|
||||||
else:
|
|
||||||
title = "comic"
|
|
||||||
filelist = []
|
|
||||||
try:
|
|
||||||
print "Splitting double pages..."
|
|
||||||
for file in os.listdir(dir):
|
|
||||||
if (getImageFileName(file) != None):
|
|
||||||
img = image.ComicPage(dir+'/'+file, profile)
|
|
||||||
img.splitPage(dir)
|
|
||||||
for file in os.listdir(dir):
|
|
||||||
if (getImageFileName(file) != None):
|
|
||||||
print "Optimizing " + file + " for " + profile
|
|
||||||
img = image.ComicPage(dir+'/'+file, profile)
|
|
||||||
img.resizeImage()
|
|
||||||
#img.frameImage()
|
|
||||||
img.quantizeImage()
|
|
||||||
img.saveToDir(dir)
|
|
||||||
except ImportError:
|
|
||||||
print "Could not load PIL, not optimizing image"
|
|
||||||
|
|
||||||
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)
|
sys.exit(0)
|
||||||
|
|||||||
@@ -1699,6 +1699,10 @@ def custom_popen(cmd):
|
|||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
creationflags = 0x08000000 # CREATE_NO_WINDOW
|
creationflags = 0x08000000 # CREATE_NO_WINDOW
|
||||||
|
|
||||||
|
out_file = open("/tmp/test.txt","w")
|
||||||
|
out_file.write('[%s]' % ', '.join(map(str, cmd)))
|
||||||
|
out_file.close()
|
||||||
|
|
||||||
# run command
|
# run command
|
||||||
p = Popen(cmd, bufsize = 0, stdout = PIPE, stdin = PIPE, stderr = STDOUT,
|
p = Popen(cmd, bufsize = 0, stdout = PIPE, stdin = PIPE, stderr = STDOUT,
|
||||||
creationflags = creationflags)
|
creationflags = creationflags)
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ cp -a resources/Scripts resources/description.rtfd resources/droplet.rsrc Kindle
|
|||||||
cp resources/Info.plist KindleComicConverter.app/Contents/
|
cp resources/Info.plist KindleComicConverter.app/Contents/
|
||||||
cp resources/comic2ebook.icns KindleComicConverter.app/Contents/Resources/droplet.icns
|
cp resources/comic2ebook.icns KindleComicConverter.app/Contents/Resources/droplet.icns
|
||||||
cp kcc/*.py KindleComicConverter.app/Contents/Resources/
|
cp kcc/*.py KindleComicConverter.app/Contents/Resources/
|
||||||
|
cp `which unrar` KindleComicConverter.app/Contents/Resources/
|
||||||
Reference in New Issue
Block a user