From f12b0260097a4bef6b287e3757edbbcecfd6343d Mon Sep 17 00:00:00 2001 From: thomasdevl <91684310+thomasdevl@users.noreply.github.com> Date: Fri, 10 Jun 2022 19:42:33 +0200 Subject: [PATCH 1/5] random thread choice change The user isn't forced to choose the random thread. Once the thread is generated he as an option of keeping it or generating an other one. --- main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 9aabe78..e1b770a 100644 --- a/main.py +++ b/main.py @@ -89,8 +89,18 @@ except: exit() console.log("[bold green]Enviroment Variables are set! Continuing...") -if configured: +def get_thread(): + ''' + The user isn't forced to choose the random thread + ''' reddit_object = get_subreddit_threads() + u_inp = input("Is this a good threads?(Y/N/Stop) :") + if u_inp.upper() == 'STOP': exit() + elif u_inp.upper() == 'Y': return reddit_object + else: get_thread() + +if configured: + reddit_object = get_thread() length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts( reddit_object, number_of_comments, os.getenv("THEME", "light") From aa8dfd71b69053bbeb322739f881b069d98cc3de Mon Sep 17 00:00:00 2001 From: thomasdevl <91684310+thomasdevl@users.noreply.github.com> Date: Fri, 10 Jun 2022 19:54:17 +0200 Subject: [PATCH 2/5] Message of changing thread --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e1b770a..6ddc1c4 100644 --- a/main.py +++ b/main.py @@ -97,7 +97,9 @@ def get_thread(): u_inp = input("Is this a good threads?(Y/N/Stop) :") if u_inp.upper() == 'STOP': exit() elif u_inp.upper() == 'Y': return reddit_object - else: get_thread() + else: + console.log(f"[red]Searching for a new thread...") + get_thread() if configured: reddit_object = get_thread() From 52433ab5e58b1ed4ac14ffdef5bc34a501934308 Mon Sep 17 00:00:00 2001 From: thomasdevl <91684310+thomasdevl@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:09:38 +0200 Subject: [PATCH 3/5] bug fix --- main.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 6ddc1c4..5b9453c 100644 --- a/main.py +++ b/main.py @@ -89,20 +89,13 @@ except: exit() console.log("[bold green]Enviroment Variables are set! Continuing...") -def get_thread(): - ''' - The user isn't forced to choose the random thread - ''' +def main(): reddit_object = get_subreddit_threads() - u_inp = input("Is this a good threads?(Y/N/Stop) :") + u_inp = input("Is this a good threads?(Y/N/Stop) :") #The user isn't forced to choose the random thread if u_inp.upper() == 'STOP': exit() - elif u_inp.upper() == 'Y': return reddit_object - else: + elif u_inp.upper() != 'Y': console.log(f"[red]Searching for a new thread...") - get_thread() - -if configured: - reddit_object = get_thread() + main() length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts( reddit_object, number_of_comments, os.getenv("THEME", "light") @@ -110,3 +103,8 @@ if configured: download_background() chop_background_video(length) final_video = make_final_video(number_of_comments) + +if configured: + main() + + From cca9f8734d00b1ca0dca8d19adc32cad6f01e156 Mon Sep 17 00:00:00 2001 From: thomasdevl <91684310+thomasdevl@users.noreply.github.com> Date: Sat, 11 Jun 2022 10:27:18 +0200 Subject: [PATCH 4/5] Added the env variable --- main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 5b9453c..33ac2ac 100644 --- a/main.py +++ b/main.py @@ -91,11 +91,14 @@ console.log("[bold green]Enviroment Variables are set! Continuing...") def main(): reddit_object = get_subreddit_threads() - u_inp = input("Is this a good threads?(Y/N/Stop) :") #The user isn't forced to choose the random thread - if u_inp.upper() == 'STOP': exit() - elif u_inp.upper() != 'Y': - console.log(f"[red]Searching for a new thread...") - main() + + if os.getenv("ONE_CLICK") == "yes": #The user isn't forced to choose the random thread + u_inp = input("Is this a good threads?(Y/N/Stop) :") + if u_inp.upper() == 'STOP': exit() + elif u_inp.upper() != 'Y': + console.log(f"[red]Searching for a new thread...") + main() + length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts( reddit_object, number_of_comments, os.getenv("THEME", "light") From eed1fc6a8a553b3f4d271ff25d359e34ca604423 Mon Sep 17 00:00:00 2001 From: thomasdevl <91684310+thomasdevl@users.noreply.github.com> Date: Sat, 11 Jun 2022 10:28:00 +0200 Subject: [PATCH 5/5] Added the .env variable --- .env.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.env.template b/.env.template index e95c209..b5de1f6 100644 --- a/.env.template +++ b/.env.template @@ -18,3 +18,6 @@ SUBREDDIT="" # Range is 0 -> 1 OPACITY="0.9" + +# Once the thread is generated you can comfirm it or generate a new one. (Yes for this to be active) +ONE_CLICK="yes"