From 9078bcff385c02a745710b8c83e32eda0d8589a2 Mon Sep 17 00:00:00 2001 From: HallowedDust5 Date: Wed, 15 Jun 2022 14:39:36 -0400 Subject: [PATCH] Added documentation --- video_creation/voices.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/video_creation/voices.py b/video_creation/voices.py index 6d81cb3..f0ec298 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -12,7 +12,7 @@ def save_text_to_mp3(reddit_obj): reddit_obj (dict): Reddit object given by get_subreddit_threads Returns: - tuple[int,int]: First index is the length of comments used, I don't know what idx is + tuple[int,int]: First index is the video length in seconds, I don't know what the second thing is """ print_step("Saving Text to MP3 files...") @@ -21,6 +21,7 @@ def save_text_to_mp3(reddit_obj): # Create a folder for the mp3 files. Path("assets/mp3").mkdir(parents=True, exist_ok=True) + # Generate title audio 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 @@ -30,11 +31,13 @@ def save_text_to_mp3(reddit_obj): except OSError as e: pass + # Generates the thread post audio if reddit_obj["thread_post"] != "": tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False) tts.save(f"assets/mp3/posttext.mp3") length += MP3(f"assets/mp3/posttext.mp3").info.length + # Generates each comment's audio for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): # ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point if length > 50: