From 02d03f1f518b2e068d8e13a34ab10982f13c9c7f Mon Sep 17 00:00:00 2001 From: sunbear99 <106839284+sunbear99@users.noreply.github.com> Date: Fri, 3 Jun 2022 15:24:53 -0600 Subject: [PATCH] Update voices.py --- video_creation/voices.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/video_creation/voices.py b/video_creation/voices.py index 43fb7fc..6b6835d 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -20,9 +20,10 @@ def save_text_to_mp3(reddit_obj): tts = gTTS(text=reddit_obj["thread_title"], lang="en", slow=False) tts.save(f"assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length - tts = gTTS(text=reddit_obj["thread_selftext"], lang="en", slow=False) - tts.save(f"assets/mp3/selftext.mp3") - length += MP3(f"assets/mp3/selftext.mp3").info.length + try: + tts = gTTS(text=reddit_obj["thread_selftext"], lang="en", slow=False) + tts.save(f"assets/mp3/selftext.mp3") + length += MP3(f"assets/mp3/selftext.mp3").info.length for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."):