From 0e70327bd3ed94f8013bdb254d671bf4552504ec Mon Sep 17 00:00:00 2001 From: iaacornus Date: Mon, 6 Jun 2022 18:22:00 +0800 Subject: [PATCH] implementation of -t parameter --- cli.py | 9 ++++++++- main.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cli.py b/cli.py index bfded52..6377460 100644 --- a/cli.py +++ b/cli.py @@ -38,6 +38,12 @@ def program_options(): help="Set a filename for the video.", action="store" ) + parser.add_argument( + "-t", + "--thread", + help="Use the given thread link instead of randomized.", + action="store" + ) args = parser.parse_args() @@ -46,7 +52,8 @@ def program_options(): main( args.subreddit, args.background, - args.filename + args.filename, + args.thread, ) else: print_substep("Error occured!", style="bold red") diff --git a/main.py b/main.py index 8892358..3e08dcb 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ from video_creation.final_video import make_final_video from utils.console import print_markdown, print_substep -def main(subreddit_=None, background=None, filename=None): +def main(subreddit_=None, background=None, filename=None, thread_link_=None): """ Load .env file if exists. If it doesnt exist, print a warning and launch the setup wizard. If there is a .env file, check if the @@ -61,7 +61,7 @@ def main(subreddit_=None, background=None, filename=None): console.log("[bold green]Enviroment Variables are set! Continuing...[/bold green]") - reddit_object = get_subreddit_threads(subreddit_) + reddit_object = get_subreddit_threads(subreddit_, thread_link_) length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts( reddit_object,