Skip to content

Commit

Permalink
cursed special chars, away with you
Browse files Browse the repository at this point in the history
  • Loading branch information
aedocw committed Nov 9, 2023
1 parent dd4ef16 commit 3148fe8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion epub2tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os
import requests
import string
import subprocess
import sys
import time
Expand Down Expand Up @@ -156,7 +157,10 @@ def get_chapters_epub(book, bookname):
for i in range(len(chapters)):
#strip some characters that might have caused TTS to choke
text = chap2text(chapters[i])
text = text.translate({ord(c): None for c in '[]*“”"\''})
#this still misses a lot of special characters...
#text = text.translate({ord(c): None for c in '[]*“”"\''})
allowed_chars = string.ascii_letters + string.digits + '-,.!? '
text = ''.join(c for c in text if c in allowed_chars)
if len(text) < 150:
#too short to bother with
continue
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author_email='[email protected]',
url='https://github.com/aedocw/epub2tts',
license='Apache License, Version 2.0',
version='1.3.11',
version='1.3.12',
packages=find_packages(),
install_requires=requirements,
py_modules=['epub2tts'],
Expand Down

0 comments on commit 3148fe8

Please sign in to comment.