diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py
index ade53ec..fd66a23 100755
--- a/kcc/comic2ebook.py
+++ b/kcc/comic2ebook.py
@@ -192,7 +192,7 @@ def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
mt = 'image/jpeg'
f.write(" \n")
- if options.profile == 'K4' or options.profile == 'KHD':
+ if (options.profile == 'K4' or options.profile == 'KHD') and splittedSomething:
f.write("- \n")
f.write("\n\n")
for entry in reflist:
@@ -260,6 +260,8 @@ def applyImgOptimization(img, isSplit=False, toRight=False):
def dirImgProcess(path):
global options
+ global splittedSomething
+ splittedSomething = False
for (dirpath, dirnames, filenames) in os.walk(path):
for afile in filenames:
@@ -271,6 +273,7 @@ def dirImgProcess(path):
img = image.ComicPage(os.path.join(dirpath, afile), options.profile)
split = img.splitPage(dirpath, options.righttoleft, options.rotate)
if split is not None:
+ splittedSomething = True
if options.verbose:
print "Splitted " + afile
if options.righttoleft:
@@ -322,7 +325,7 @@ def genEpubStruct(path):
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
filelist.sort(key=lambda name: (alphanum_key(name[0].lower()), alphanum_key(name[1].lower())))
buildOPF(options.profile, path, options.title, filelist, cover, options.righttoleft)
- if options.profile == 'K4' or options.profile == 'KHD':
+ if (options.profile == 'K4' or options.profile == 'KHD') and splittedSomething:
filelist.append(buildBlankHTML(os.path.join(path, 'OEBPS', 'Text')))
diff --git a/kcc/image.py b/kcc/image.py
index 1cc186a..55e9086 100755
--- a/kcc/image.py
+++ b/kcc/image.py
@@ -163,7 +163,7 @@ class ComicPage:
if (float(self.image.size[0]) / float(self.image.size[1])) < ratioDev:
diff = int(self.image.size[1] * ratioDev) - self.image.size[0]
if isSplit and (profile == 'K4' or profile == 'KHD'):
- diff = 2
+ diff = 2
self.image = ImageOps.expand(self.image, border=(diff / 2, 0), fill=fill)
elif (float(self.image.size[0]) / float(self.image.size[1])) > ratioDev:
diff = int(self.image.size[0] / ratioDev) - self.image.size[1]