From 45e3a1144012b1dc5b9a1ced9402812ee0e5d52c Mon Sep 17 00:00:00 2001 From: Lewis Menelaws Date: Thu, 2 Jun 2022 14:51:34 -0400 Subject: [PATCH] Refactored for easier merging and fixed dependencies. --- main.py | 2 +- reddit/{askreddit.py => subreddit.py} | 10 ++++++---- requirements.txt | 2 +- video_creation/background.py | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) rename reddit/{askreddit.py => subreddit.py} (86%) diff --git a/main.py b/main.py index 474a062..1aa85d2 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ from utils.console import print_markdown import time -from reddit.askreddit import get_askreddit_threads +from reddit.subreddit import get_askreddit_threads from video_creation.background import download_background, chop_background_video from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts diff --git a/reddit/askreddit.py b/reddit/subreddit.py similarity index 86% rename from reddit/askreddit.py rename to reddit/subreddit.py index a70fbe3..8c79ed9 100644 --- a/reddit/askreddit.py +++ b/reddit/subreddit.py @@ -13,13 +13,15 @@ def get_askreddit_threads(): load_dotenv() print_step("Getting AskReddit threads...") - - if os.getenv("REDDIT_2FA") == "yes" or "YES": - print("\nEnter your two-factor authentication code from your authenticator app.\n") + print(os.getenv("REDDIT_2FA")) + if os.getenv("REDDIT_2FA").lower() == "yes": + print( + "\nEnter your two-factor authentication code from your authenticator app.\n" + ) code = input("> ") print() pw = os.getenv("REDDIT_PASSWORD") - passkey = f'{pw}:{code}' + passkey = f"{pw}:{code}" else: passkey = os.getenv("REDDIT_PASSWORD") diff --git a/requirements.txt b/requirements.txt index b2f5ee4..8c5cc8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ mccabe==0.6.1 moviepy==1.0.3 mutagen==1.45.1 mypy-extensions==0.4.3 -numpy==1.15.1 +numpy==1.22.3 pathspec==0.8.0 Pillow==9.1.1 playwright==1.22.0 diff --git a/video_creation/background.py b/video_creation/background.py index e917b70..6884221 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -25,8 +25,8 @@ def download_background(): print_substep("Downloading the background video... please be patient.") ydl_opts = { - 'outtmpl': 'assets/mp4/background', - 'merge_output_format': 'mp4', + "outtmpl": "assets/mp4/background.mp4", + "merge_output_format": "mp4", } with YoutubeDL(ydl_opts) as ydl: