mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
fix scribe order
This commit is contained in:
@@ -371,13 +371,13 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
page_spread_property_list = []
|
||||
for entry in reflist:
|
||||
if options.righttoleft:
|
||||
if entry.endswith("-kcc-a"):
|
||||
if "-kcc-a" in entry:
|
||||
page_spread_property_list.append("center")
|
||||
pageside = "right"
|
||||
elif entry.endswith("-kcc-b"):
|
||||
elif "-kcc-b" in entry:
|
||||
page_spread_property_list.append("right")
|
||||
pageside = "right"
|
||||
elif entry.endswith("-kcc-c"):
|
||||
elif "-kcc-c" in entry:
|
||||
page_spread_property_list.append("left")
|
||||
pageside = "right"
|
||||
else:
|
||||
@@ -387,13 +387,13 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
else:
|
||||
pageside = "right"
|
||||
else:
|
||||
if entry.endswith("-kcc-a"):
|
||||
if "-kcc-a" in entry:
|
||||
page_spread_property_list.append("center")
|
||||
pageside = "left"
|
||||
elif entry.endswith("-kcc-b"):
|
||||
elif "-kcc-b" in entry:
|
||||
page_spread_property_list.append("left")
|
||||
pageside = "left"
|
||||
elif entry.endswith("-kcc-c"):
|
||||
elif "-kcc-c" in entry:
|
||||
page_spread_property_list.append("right")
|
||||
pageside = "left"
|
||||
else:
|
||||
@@ -407,7 +407,7 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
spread_seen = False
|
||||
for i in range(len(reflist) -1, -1, -1):
|
||||
entry = reflist[i]
|
||||
if not entry.endswith("-kcc"):
|
||||
if "-kcc-x" not in entry:
|
||||
spread_seen = True
|
||||
if options.righttoleft:
|
||||
pageside = "left"
|
||||
@@ -951,7 +951,7 @@ def detectSuboptimalProcessing(tmppath, orgpath):
|
||||
for root, _, files in os.walk(tmppath, False):
|
||||
for name in files:
|
||||
if getImageFileName(name) is not None:
|
||||
if not alreadyProcessed and getImageFileName(name)[0].endswith('-kcc'):
|
||||
if not alreadyProcessed and '-kcc' in getImageFileName(name)[0]:
|
||||
alreadyProcessed = True
|
||||
path = os.path.join(root, name)
|
||||
pathOrg = orgpath + path.split('OEBPS' + os.path.sep + 'Images')[1]
|
||||
|
||||
@@ -288,15 +288,15 @@ class ComicPage:
|
||||
self.orgPath = os.path.join(path[0], path[1])
|
||||
self.targetPathStart = os.path.join(path[0], os.path.splitext(path[1])[0])
|
||||
if 'N' in mode:
|
||||
self.targetPathEnd = '-kcc'
|
||||
self.targetPathOrder = '-kcc-x'
|
||||
elif 'R' in mode:
|
||||
self.targetPathEnd = '-kcc-a'
|
||||
self.targetPathOrder = '-kcc-a'
|
||||
if not options.norotate:
|
||||
self.rotated = True
|
||||
elif 'S1' in mode:
|
||||
self.targetPathEnd = '-kcc-b'
|
||||
self.targetPathOrder = '-kcc-b'
|
||||
elif 'S2' in mode:
|
||||
self.targetPathEnd = '-kcc-c'
|
||||
self.targetPathOrder = '-kcc-c'
|
||||
# backwards compatibility for Pillow >9.1.0
|
||||
if not hasattr(Image, 'Resampling'):
|
||||
Image.Resampling = Image
|
||||
@@ -312,10 +312,12 @@ class ComicPage:
|
||||
flags.append('BlackBackground')
|
||||
if self.opt.kindle_scribe_azw3 and self.image.size[1] > 1920:
|
||||
w, h = self.image.size
|
||||
targetPath = self.save_with_codec(self.image.crop((0, 0, w, 1920)), self.targetPathStart + '-above' + self.targetPathEnd)
|
||||
self.save_with_codec(self.image.crop((0, 1920, w, h)), self.targetPathStart + '-below' + self.targetPathEnd)
|
||||
targetPath = self.save_with_codec(self.image.crop((0, 0, w, 1920)), self.targetPathStart + self.targetPathOrder + '-above')
|
||||
self.save_with_codec(self.image.crop((0, 1920, w, h)), self.targetPathStart + self.targetPathOrder + '-below')
|
||||
elif self.opt.kindle_scribe_azw3:
|
||||
targetPath = self.save_with_codec(self.image, self.targetPathStart + self.targetPathOrder + '-whole')
|
||||
else:
|
||||
targetPath = self.save_with_codec(self.image, self.targetPathStart + self.targetPathEnd)
|
||||
targetPath = self.save_with_codec(self.image, self.targetPathStart + self.targetPathOrder)
|
||||
if os.path.isfile(self.orgPath):
|
||||
os.remove(self.orgPath)
|
||||
return [Path(targetPath).name, flags]
|
||||
|
||||
Reference in New Issue
Block a user