|
|
@ -94,10 +94,14 @@ class TTSEngine:
|
|
|
|
|
|
|
|
|
|
|
|
def call_tts(self, filename: str, text: str):
|
|
|
|
def call_tts(self, filename: str, text: str):
|
|
|
|
self.tts_module.run(text=process_text(text), filepath=f"{self.path}/{filename}.mp3")
|
|
|
|
self.tts_module.run(text=process_text(text), filepath=f"{self.path}/{filename}.mp3")
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.length += MP3(f"{self.path}/{filename}.mp3").info.length
|
|
|
|
self.length += MP3(f"{self.path}/{filename}.mp3").info.length
|
|
|
|
except (MutagenError, HeaderNotFoundError):
|
|
|
|
except (MutagenError, HeaderNotFoundError):
|
|
|
|
self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
|
|
|
|
self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
|
|
|
|
|
|
|
|
except Exception: # last resort backup
|
|
|
|
|
|
|
|
clip = AudioFileClip(f"{self.path}/{filename}.mp3")
|
|
|
|
|
|
|
|
self.length += clip.duration
|
|
|
|
|
|
|
|
|
|
|
|
def process_text(text: str):
|
|
|
|
def process_text(text: str):
|
|
|
|
lang = getenv("POSTLANG", "")
|
|
|
|
lang = getenv("POSTLANG", "")
|
|
|
|