From 708016c5839250dc064d65708a57181c3ef0aec6 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 3 Jul 2022 17:42:18 +0100 Subject: [PATCH] fix: mutagen error - moved to moviepy duration --- TTS/engine_wrapper.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index a06b4b9..692cfdc 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -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)