fix: mutagen error - moved to moviepy duration

This commit is contained in:
Callum Leslie committed 2022-07-03 17:42:18 +01:00
1 parent 89f4644ce9
commit 708016c583
1 file changed
+6 -5
+6 -5
View File
@@ -94,11 +94,12 @@ class TTSEngine:
def call_tts(self, filename: str, text: str):
self.tts_module.run(text=process_text(text), filepath=f"{self.path}/{filename}.mp3")
try:
self.length += MP3(f"{self.path}/{filename}.mp3").info.length
except (MutagenError, HeaderNotFoundError):
self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
# try:
# self.length += MP3(f"{self.path}/{filename}.mp3").info.length
# except (MutagenError, HeaderNotFoundError):
# self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
clip = AudioFileClip(f"{self.path}/{filename}.mp3")
self.length += clip.duration
def process_text(text: str):
lang = getenv("POSTLANG", "")
new_text = sanitize_text(text)