Skip to content

Commit

Permalink
change kobo epub filenames (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
axu2 authored Dec 21, 2023
1 parent c29a4be commit 6cdd9d5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kindlecomicconverter/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#

import os
import pathlib
import re
import subprocess
import sys
from argparse import ArgumentParser
from time import strftime, gmtime
Expand Down Expand Up @@ -672,11 +675,9 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
filename = srcpath + tomenumber + ext
else:
if 'Ko' in options.profile and options.format == 'EPUB':
path = srcpath.split(os.path.sep)
path[-1] = ''.join(e for e in path[-1].split('.')[0] if e.isalnum()) + tomenumber + ext
if not path[-1].split('.')[0]:
path[-1] = 'KCCPlaceholder' + tomenumber + ext
filename = os.path.sep.join(path)
src = pathlib.Path(srcpath)
name = re.sub(r'\W+', '_', src.stem) + tomenumber + ext
filename = src.with_name(name)
else:
filename = os.path.splitext(srcpath)[0] + tomenumber + ext
if os.path.isfile(filename):
Expand Down

0 comments on commit 6cdd9d5

Please sign in to comment.