diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py
index 9e8b341..f6eef10 100644
--- a/kcc/KCC_gui.py
+++ b/kcc/KCC_gui.py
@@ -422,7 +422,8 @@ class Ui_KCC(object):
if "Amazon kindlegen" in line:
versionCheck = line.split('V')[1].split(' ')[0]
if tuple(map(int, (versionCheck.split(".")))) < tuple(map(int, ('2.9'.split(".")))):
- self.addMessage('Your kindlegen is outdated! Creating MOBI might fail, please update kindlegen from Amazon\'s website.', 'warning')
+ self.addMessage('Your kindlegen is outdated! Creating MOBI might fail.'
+ ' Please update kindlegen from Amazon\'s website.', 'warning')
break
else:
self.KindleGen = False
diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py
index a7a7de7..f0bc22a 100755
--- a/kcc/comic2ebook.py
+++ b/kcc/comic2ebook.py
@@ -165,6 +165,9 @@ def buildBlankHTML(path):
def buildNCX(dstdir, title, chapters):
+ from uuid import uuid4
+ options.uuid = str(uuid4())
+ options.uuid = options.uuid.encode('utf-8')
ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx')
f = open(ncxfile, "w")
f.writelines(["\n",
@@ -172,7 +175,7 @@ def buildNCX(dstdir, title, chapters):
"\"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd\">\n",
"\n",
"\n",
- "\n",
+ "\n",
"\n",
"\n",
"\n",
@@ -185,7 +188,7 @@ def buildNCX(dstdir, title, chapters):
title = os.path.basename(folder)
filename = getImageFileName(os.path.join(folder, chapter[1]))
f.write("" + title
- + "\n")
+ + "\n")
f.write("\n")
f.close()
return
@@ -205,9 +208,6 @@ def buildOPF(dstdir, title, filelist, cover=None):
facing = "left"
facing1 = "left"
facing2 = "right"
- from uuid import uuid4
- uuid = str(uuid4())
- uuid = uuid.encode('utf-8')
f = open(opffile, "w")
f.writelines(["\n",
"\n",
@@ -215,7 +215,7 @@ def buildOPF(dstdir, title, filelist, cover=None):
"xmlns:opf=\"http://www.idpf.org/2007/opf\">\n",
"", title, "\n",
"en-US\n",
- "", uuid, "\n",
+ "", options.uuid, "\n",
"\n",
"\n",
"\n",
@@ -240,10 +240,10 @@ def buildOPF(dstdir, title, filelist, cover=None):
mt = 'image/png'
else:
mt = 'image/jpeg'
- f.write(" \n")
+ f.write(" \n")
reflist = []
for path in filelist:
- folder = path[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
+ folder = path[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\').replace("\\", "/")
filename = getImageFileName(path[1])
uniqueid = os.path.join(folder, filename[0]).replace('/', '_').replace('\\', '_')
reflist.append(uniqueid)
@@ -580,7 +580,8 @@ def genEpubStruct(path):
chapterlist.append((dirpath.replace('Images', 'Text'), filelist[-1][1]))
chapter = True
if cover is None:
- cover = os.path.join(filelist[-1][0], 'cover' + getImageFileName(filelist[-1][1])[1])
+ cover = os.path.join(os.path.join(path, 'OEBPS', 'Images'),
+ 'cover' + getImageFileName(filelist[-1][1])[1])
copyfile(os.path.join(filelist[-1][0], filelist[-1][1]), cover)
buildNCX(path, options.title, chapterlist)
# ensure we're sorting files alphabetically