From 5d597ca9e8fa7b9f0142294b5fb84c8d95eaa7b0 Mon Sep 17 00:00:00 2001 From: iaacornus Date: Wed, 8 Jun 2022 00:27:23 +0800 Subject: [PATCH] bug fixes --- cli.py | 4 ++-- main.py | 2 +- reddit/subreddit.py | 2 +- video_creation/background.py | 16 ++++++++-------- video_creation/final_video.py | 4 ++-- video_creation/screenshot_downloader.py | 2 +- video_creation/voices.py | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cli.py b/cli.py index b6cc850..1851243 100644 --- a/cli.py +++ b/cli.py @@ -75,10 +75,10 @@ def program_options(): elif args.setup: setup() else: - print_substep("Error occured!", style="bold red") + print_substep("Error occured!", style_="bold red") raise SystemExit() except KeyboardInterrupt: - print_substep("\nOperation Aborted!", style="bold red") + print_substep("\nOperation Aborted!", style_="bold red") if __name__ == "__main__": diff --git a/main.py b/main.py index d470aa1..6937cf8 100644 --- a/main.py +++ b/main.py @@ -52,7 +52,7 @@ def main( for val in REQUIRED_VALUES: if not os.getenv(val): print_substep( - f"Please set the variable \"{val}\" in your .env file.", style="bold red" + f"Please set the variable \"{val}\" in your .env file.", style_="bold red" ) configured = False diff --git a/reddit/subreddit.py b/reddit/subreddit.py index f7bfecf..2bd1f8a 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -128,6 +128,6 @@ def get_subreddit_threads(subreddit_, thread_link_, number_of_comments): except AttributeError: pass - print_substep("AskReddit threads retrieved successfully.", style="bold green") + print_substep("AskReddit threads retrieved successfully.", style_="bold green") return content diff --git a/video_creation/background.py b/video_creation/background.py index 192a686..d328f82 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -31,7 +31,7 @@ def download_background(background): background_check = os.path.isfile("assets/mp4/background.mp4") if background_check and background is not None: print_substep( - "Background video is already downloaded! Replacing ...", style="bold red" + "Background video is already downloaded! Replacing ...", style_="bold red" ) os.remove("assets/mp4/background.mp4") @@ -49,21 +49,21 @@ def download_background(background): ) if check_link: - print_substep(f"Downloading video from: {background}", style="bold") + print_substep(f"Downloading video from: {background}", style_="bold") ydl.download(background) elif re.match(background[-4], "mp4"): - print_substep(f"Using the given video file: {background}", style="bold") + print_substep(f"Using the given video file: {background}", style_="bold") os.replace(background.strip(), "assets/mp4/background.mp4") else: # if the link is not youtube link or a file raise ValueError except ValueError: - print_substep("Invalid input!", style="bold red") + print_substep("Invalid input!", style_="bold red") except ConnectionError: - print_substep("There is a connection error!", style="bold red") + print_substep("There is a connection error!", style_="bold red") except DownloadError: - print_substep("There is a download error!", style="bold red") + print_substep("There is a download error!", style_="bold red") else: - print_substep("Background video downloaded successfully!", style="bold green") + print_substep("Background video downloaded successfully!", style_="bold green") cancel = False if cancel: @@ -82,4 +82,4 @@ def chop_background_video(video_length): end_time, targetname="assets/mp4/clip.mp4", ) - print_substep("Background video chopped successfully!", style="bold green") + print_substep("Background video chopped successfully!", style_="bold green") diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 2d23bc8..585e6bf 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -40,7 +40,7 @@ def make_final_video(number_of_clips, file_name): TypeError ): print_substep( - "Please ensure that OPACITY is between 0 and 1 in .env file", style="bold red" + "Please ensure that OPACITY is between 0 and 1 in .env file", style_="bold red" ) # Gather all audio clips @@ -55,7 +55,7 @@ def make_final_video(number_of_clips, file_name): OSError, FileNotFoundError, ): - print_substep("An error occured! Aborting.", style="bold red") + print_substep("An error occured! Aborting.", style_="bold red") raise SystemExit() else: audio_concat = concatenate_audioclips(audio_clips) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 3aca45f..eb1bbba 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -59,4 +59,4 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): f"#t1_{comment['comment_id']}" ).screenshot(path=f"assets/png/comment_{idx}.png") - print_substep("Screenshots downloaded Successfully.", style="bold green") + print_substep("Screenshots downloaded Successfully.", style_="bold green") diff --git a/video_creation/voices.py b/video_creation/voices.py index c6df660..c22e9c5 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -51,6 +51,6 @@ def save_text_to_mp3(reddit_obj): tts.save(f"assets/mp3/{idx}.mp3") length += MP3(f"assets/mp3/{idx}.mp3").info.length - print_substep("Saved Text to MP3 files successfully.", style="bold green") + print_substep("Saved Text to MP3 files successfully.", style_="bold green") # ! Return the index so we know how many screenshots of comments we need to make. return length, idx