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