mirror of
https://github.com/ciromattia/kcc
synced 2026-07-12 16:03:19 +00:00
Resolved problems with page order on Kobo
This commit is contained in:
@@ -723,6 +723,24 @@ def sanitizeTree(filetree):
|
|||||||
return chapterNames
|
return chapterNames
|
||||||
|
|
||||||
|
|
||||||
|
def sanitizeTreeKobo(filetree):
|
||||||
|
pageNumber = 0
|
||||||
|
for root, dirs, files in os.walk(filetree):
|
||||||
|
files.sort()
|
||||||
|
dirs.sort()
|
||||||
|
for name in files:
|
||||||
|
splitname = os.path.splitext(name)
|
||||||
|
slugified = str(pageNumber).zfill(5)
|
||||||
|
pageNumber += 1
|
||||||
|
while os.path.exists(os.path.join(root, slugified + splitname[1])) and splitname[0].upper()\
|
||||||
|
!= slugified.upper():
|
||||||
|
slugified += "A"
|
||||||
|
newKey = os.path.join(root, slugified + splitname[1])
|
||||||
|
key = os.path.join(root, name)
|
||||||
|
if key != newKey:
|
||||||
|
os.replace(key, newKey)
|
||||||
|
|
||||||
|
|
||||||
def sanitizePermissions(filetree):
|
def sanitizePermissions(filetree):
|
||||||
for root, dirs, files in os.walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
@@ -1077,6 +1095,8 @@ def makeBook(source, qtGUI=None):
|
|||||||
if GUI:
|
if GUI:
|
||||||
GUI.progressBarTick.emit('1')
|
GUI.progressBarTick.emit('1')
|
||||||
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
|
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
|
||||||
|
if 'Ko' in options.profile and options.cbzoutput:
|
||||||
|
sanitizeTreeKobo(os.path.join(path, 'OEBPS', 'Images'))
|
||||||
if options.batchsplit:
|
if options.batchsplit:
|
||||||
tomes = splitDirectory(path)
|
tomes = splitDirectory(path)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user