From 2b0d66f451cd31f377b685ebedca0929a84080d4 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 10 Jul 2022 11:54:51 -0400 Subject: [PATCH] added backup contingency --- TTS/engine_wrapper.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 4f3cf1c..160c61a 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -114,9 +114,12 @@ class TTSEngine: # 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 - clip.close() + try: + clip = AudioFileClip(f"{self.path}/{filename}.mp3") + self.length += clip.duration + clip.close() + except: + self.length = 0 def process_text(text: str):