1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 09:46:25 +00:00

Resolved problems with page order on Kobo

This commit is contained in:
Paweł Jastrzębski
2014-07-04 09:59:21 +02:00
parent 94f56238ae
commit 4571fadadb

View File

@@ -723,6 +723,24 @@ def sanitizeTree(filetree):
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):
for root, dirs, files in os.walk(filetree, False):
for name in files:
@@ -1077,6 +1095,8 @@ def makeBook(source, qtGUI=None):
if GUI:
GUI.progressBarTick.emit('1')
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:
tomes = splitDirectory(path)
else: