From f404b9090d0242cc38ca90b21f81392b886f80b2 Mon Sep 17 00:00:00 2001 From: fsteffek Date: Thu, 19 Feb 2015 22:33:25 +0100 Subject: [PATCH] Set first image in folder as cover The walk() function does not necessarily return filenames in alphabetical order. This leads to a random cover image. Sorting filenames before setting the cover images fixes this issue. --- kcc/comic2ebook.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index e72d911..31e1e8f 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -424,6 +424,7 @@ def buildEPUB(path, chapterNames, tomeNumber): f.close() for (dirpath, dirnames, filenames) in walk(os.path.join(path, 'OEBPS', 'Images')): chapter = False + filenames.sort() for afile in filenames: filename = getImageFileName(afile) if '-kcc-hq' not in filename[0]: