From 81e8a5d6fbbd305937eafcfc4ce7ee2562f23014 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 31 May 2022 23:01:15 -0400 Subject: [PATCH] HOLY SHITNUGGIES IT WORKS! --- main.py | 4 ++-- video_creation/background.py | 6 +++--- video_creation/voices.py | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index b6a9d1c..fd7a139 100644 --- a/main.py +++ b/main.py @@ -7,9 +7,9 @@ from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.final_video import make_final_video +# base code by elebumm print_markdown( - "### Thanks for using this tool! 😊 [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com). If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue." -) + "### Thanks for using this tool! 😊 Feel free to contribute to this project on GitHub! (JasonLovesDoggo/RedditVideoMakerBot). If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue.") time.sleep(2) diff --git a/video_creation/background.py b/video_creation/background.py index ac276b0..f146ade 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -25,9 +25,9 @@ def download_background(): background_options = [ # uri , filename , credit ("https://www.youtube.com/watch?v=n_Dv4JMiwK8", "parkour.mp4", 'bbswitzer'), ("https://www.youtube.com/watch?v=2X9QGY__0II", "rocket_league.mp4", 'Orbital Gameplay'), ] - # note: make sure the file name doesn't include a - in it - print(listdir('./assets/backgrounds'), 'podsods', len(background_options)) - if listdir('./assets/backgrounds') != len(background_options): + # note: make sure the file name doesn't include a - in it + if len(listdir('./assets/backgrounds')) != len( + background_options): # if there are any background videos not installed print_step("We need to download the backgnrounds videos. they are fairly large but it's only done once. 😎") print_substep("Downloading the backgrounds videos... please be patient 🙏 ") with Progress() as progress: diff --git a/video_creation/voices.py b/video_creation/voices.py index 2ef0bcf..47c4960 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -1,5 +1,7 @@ import sox from pathlib import Path + +from mutagen import MutagenError from mutagen.mp3 import MP3, HeaderNotFoundError from utils.console import print_step, print_substep from rich.progress import track @@ -34,7 +36,7 @@ def save_text_to_mp3(reddit_obj): ttttsw.tts(comment["comment_body"], filename=f"assets/temp/mp3/{idx}.mp3", random_speaker=False) try: length += MP3(f"assets/temp/mp3/{idx}.mp3").info.length - except HeaderNotFoundError: + except HeaderNotFoundError or MutagenError: length = sox.file_info.duration(f"assets/temp/mp3/{idx}.mp3") print_substep("Saved Text to MP3 files Successfully.", style="bold green")