Formatting and PEP-8 codestyle

This commit is contained in:
Ciro Mattia Gonano committed 2013-03-05 11:54:23 +01:00
1 parent 3c187889d1
commit cc3237d051
2 files changed
+10 -8

No files matched your search

+9 -7
View File
@@ -86,6 +86,7 @@ def buildHTML(path, imgfile):
f.close() f.close()
return path, imgfile return path, imgfile
def buildBlankHTML(path): def buildBlankHTML(path):
f = open(os.path.join(path, 'blank.html'), "w") f = open(os.path.join(path, 'blank.html'), "w")
f.writelines(["<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ", f.writelines(["<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ",
@@ -97,11 +98,11 @@ def buildBlankHTML(path):
"</head>\n", "</head>\n",
"<body>\n", "<body>\n",
"</body>\n", "</body>\n",
"</html>" "</html>"])
])
f.close() f.close()
return path return path
def buildNCX(dstdir, title, chapters): def buildNCX(dstdir, title, chapters):
ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx') ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx')
f = open(ncxfile, "w") f = open(ncxfile, "w")
@@ -197,7 +198,8 @@ def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
f.write("</manifest>\n<spine toc=\"ncx\">\n") f.write("</manifest>\n<spine toc=\"ncx\">\n")
for entry in reflist: for entry in reflist:
if entry.endswith("-1"): if entry.endswith("-1"):
if ((righttoleft and facing == 'left') or (not righttoleft and facing == 'right')) and (options.profile == 'K4' or options.profile == 'KHD'): if (righttoleft and facing == 'left') or (not righttoleft and facing == 'right') and \
(options.profile == 'K4' or options.profile == 'KHD'):
f.write("<itemref idref=\"blank-page\" properties=\"layout-blank\"/>\n") f.write("<itemref idref=\"blank-page\" properties=\"layout-blank\"/>\n")
f.write("<itemref idref=\"page_" + entry + "\" properties=\"page-spread-" + facing1 + "\"/>\n") f.write("<itemref idref=\"page_" + entry + "\" properties=\"page-spread-" + facing1 + "\"/>\n")
elif entry.endswith("-2"): elif entry.endswith("-2"):
@@ -277,11 +279,11 @@ def dirImgProcess(path):
if options.verbose: if options.verbose:
print "Splitted " + afile print "Splitted " + afile
if options.righttoleft: if options.righttoleft:
toRight1 = False; toRight1 = False
toRight2 = True; toRight2 = True
else: else:
toRight1 = True; toRight1 = True
toRight2 = False; toRight2 = False
img0 = image.ComicPage(split[0], options.profile) img0 = image.ComicPage(split[0], options.profile)
applyImgOptimization(img0, True, toRight1) applyImgOptimization(img0, True, toRight1)
img0.saveToDir(dirpath) img0.saveToDir(dirpath)
+1 -1
View File
@@ -57,7 +57,7 @@ setup(
version=VERSION, version=VERSION,
author="Ciro Mattia Gonano", author="Ciro Mattia Gonano",
author_email="ciromattia@gmail.com", author_email="ciromattia@gmail.com",
description=("A tool to convert comics (CBR/CBZ/PDFs/image folders) to Mobipocket."), description="A tool to convert comics (CBR/CBZ/PDFs/image folders) to Mobipocket.",
license = "ISC License (ISCL)", license = "ISC License (ISCL)",
keywords = "kindle comic mobipocket mobi cbz cbr manga", keywords = "kindle comic mobipocket mobi cbz cbr manga",
url = "http://github.com/ciromattia/kcc", url = "http://github.com/ciromattia/kcc",