Skip to content

Commit

Permalink
force removal of kcc-0000 file on epub creation
Browse files Browse the repository at this point in the history
  • Loading branch information
VampiroMedicado committed Jan 3, 2024
1 parent 4854140 commit 72d6888
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions kindlecomicconverter/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def pageSpreadProperty(pageside):


def buildEPUB(path, chapternames, tomenumber):
first_image_pattern = re.compile(r'^kcc-0000.*')
filelist = []
chapterlist = []
cover = None
Expand Down Expand Up @@ -507,14 +508,18 @@ def buildEPUB(path, chapternames, tomenumber):
dirnames, filenames = walkSort(dirnames, filenames)
for afile in filenames:
filelist.append(buildHTML(dirpath, afile, os.path.join(dirpath, afile)))
if not chapter:
chapterlist.append((dirpath.replace('Images', 'Text'), filelist[-1][1]))
chapter = True
if cover is None:
cover = os.path.join(os.path.join(path, 'OEBPS', 'Images'),
'cover' + getImageFileName(filelist[-1][1])[1])
'cover' + getImageFileName(filelist[-1][1])[1])
options.covers.append((image.Cover(os.path.join(filelist[-1][0], filelist[-1][1]), cover, options,
tomenumber), options.uuid))
tomenumber), options.uuid))
if not chapter:
if bool(first_image_pattern.match(filelist[-1][1])):
os.remove(os.path.join(filelist[-1][0], filelist[-1][1]))
filelist.pop()
else:
chapterlist.append((dirpath.replace('Images', 'Text'), filelist[-1][1]))
chapter = True
# Overwrite chapternames if tree is flat and ComicInfo.xml has bookmarks
if not chapternames and options.chapters:
chapterlist = []
Expand Down

0 comments on commit 72d6888

Please sign in to comment.