|
|
|
@ -21,7 +21,6 @@ DEFUALT_MAX_LENGTH: int = 50 # video length variable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TTSEngine:
|
|
|
|
|
|
|
|
|
|
"""Calls the given TTS engine to reduce code duplication and allow multiple TTS engines.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
@ -89,7 +88,6 @@ class TTSEngine:
|
|
|
|
|
r" *(((.|\n){0," + str(self.tts_module.max_chars) + "})(\.|.$))", text
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
offset = 0
|
|
|
|
|
try:
|
|
|
|
|
silence_duration = settings.config["settings"]["tts"]["silence_duration"]
|
|
|
|
|
except AttributeError:
|
|
|
|
@ -100,9 +98,9 @@ class TTSEngine:
|
|
|
|
|
|
|
|
|
|
idy = None
|
|
|
|
|
for idy, text_cut in enumerate(split_text):
|
|
|
|
|
|
|
|
|
|
newtext = process_text(text_cut)
|
|
|
|
|
print(f"{idx}-{idy}: {newtext}\n")
|
|
|
|
|
#print(f"{idx}-{idy}: {newtext}\n")
|
|
|
|
|
|
|
|
|
|
if not newtext or newtext.isspace():
|
|
|
|
|
print("newtext was blank because sanitized split text resulted in none")
|
|
|
|
|
continue
|
|
|
|
@ -153,7 +151,7 @@ class TTSEngine:
|
|
|
|
|
try:
|
|
|
|
|
name = ["title_no_silence.mp3", "silence.mp3", "title.txt"]
|
|
|
|
|
for i in range(0, len(name)):
|
|
|
|
|
os.unlink(str(rf"{self.path}/"+name[i]))
|
|
|
|
|
os.unlink(str(rf"{self.path}/" + name[i]))
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
print("file not found error")
|
|
|
|
|
except OSError:
|
|
|
|
@ -169,6 +167,7 @@ class TTSEngine:
|
|
|
|
|
except:
|
|
|
|
|
self.length = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def process_text(text: str):
|
|
|
|
|
lang = settings.config["reddit"]["thread"]["post_lang"]
|
|
|
|
|
new_text = sanitize_text(text)
|
|
|
|
|