keep spaces, remove special characters in kepub filenames (#1465)

* rename KEPUBs same as Kobo touch driver

* add kepub ! note
This commit is contained in:
Alex Xu
2026-10-18 15:05:28 -07:00
committed by GitHub
parent eed896a4e0
commit 4b48b045d2
2 changed files with 7 additions and 2 deletions
+2
View File
@@ -160,6 +160,8 @@ For flatpak, Docker, and AppImage versions, refer to the wiki: https://github.co
- MOBI for modern Kindles. [CBZ for KF7 Kindles](https://ebooks.stackexchange.com/questions/173/how-to-use-the-e-ink-kindle-readers-to-display-photos) like the Kindle 1/2/3/DX. CBZ for Koreader. KEPUB for Kobo (Kobo profile + EPUB = KEPUB). PDF for ReMarkable or Kindle Scribe 2025.
- Where is KEPUB option?
- Choosing a Kobo profile and EPUB output will output KEPUB.
- KEPUB crashes on Kobo?
- Remove any special characters like `!` from the filepath, including any intermediate **folders.**
- All options have additional information in tooltips if you hover over the option.
- To get the converted book onto your Kindle/Kobo, just drag and drop the mobi/kepub into the documents folder on your Kindle/Kobo via USB
- Kindle panel view not working?
+5 -2
View File
@@ -69,6 +69,9 @@ ImageFile.LOAD_TRUNCATED_IMAGES = True
OS_SORT_KEY = os_sort_keygen()
KF7_KINDLES = ('K1', 'K2', 'K34', 'KDX')
# https://www.mobileread.com/forums/showpost.php?p=4213802&postcount=4
KOBO_TOUCH_DRIVER_REGEX = re.compile(r'[\/\\\?%\*:;\|\"\'><\$!]')
def main(argv=None):
global options
parser = makeParser()
@@ -1101,9 +1104,9 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
else:
if 'Ko' in options.profile and options.format == 'EPUB':
if source_path.is_file():
name = re.sub(r'\W+', '_', source_path.stem) + tomenumber + ext
name = KOBO_TOUCH_DRIVER_REGEX.sub('_', source_path.stem) + tomenumber + ext
else:
name = re.sub(r'\W+', '_', source_path.name) + tomenumber + ext
name = KOBO_TOUCH_DRIVER_REGEX.sub('_', source_path.name) + tomenumber + ext
filename = source_path.with_name(name)
else:
filename = os.path.splitext(srcpath)[0] + tomenumber + ext