Added the possibility to request a new thread, without exiting the program and starting it again.

pull/364/head
Daniel Berger 3 years ago
parent 2ac69da449
commit 30abf51446

@ -88,6 +88,9 @@ console.log("[bold green]Enviroment Variables are set! Continuing...")
if configured: if configured:
reddit_object = get_subreddit_threads() reddit_object = get_subreddit_threads()
if (reddit_object == -1):
exit()
length, number_of_comments = save_text_to_mp3(reddit_object) length, number_of_comments = save_text_to_mp3(reddit_object)
download_screenshots_of_reddit_posts( download_screenshots_of_reddit_posts(
reddit_object, number_of_comments, os.getenv("THEME", "light") reddit_object, number_of_comments, os.getenv("THEME", "light")

@ -29,6 +29,9 @@ def get_subreddit_threads():
else: else:
passkey = os.getenv("REDDIT_PASSWORD") passkey = os.getenv("REDDIT_PASSWORD")
print_step("Getting AskReddit threads...")
accept_thread = False
while (accept_thread == False):
content = {} content = {}
reddit = praw.Reddit( reddit = praw.Reddit(
client_id=os.getenv("REDDIT_CLIENT_ID"), client_id=os.getenv("REDDIT_CLIENT_ID"),
@ -66,6 +69,15 @@ def get_subreddit_threads():
submission = list(threads)[random.randrange(0, 25)] submission = list(threads)[random.randrange(0, 25)]
print_substep(f"Video will be: {submission.title} :thumbsup:") print_substep(f"Video will be: {submission.title} :thumbsup:")
response = input("Is this thread acceptable? [yes/no/exit]: ").strip().lower()
if response == "yes" or response == "y":
accept_thread = TRUE
elif response == "exit":
return -1
else:
print_step("Getting new AskReddit threads...")
console.log("Getting video comments...") console.log("Getting video comments...")
try: try:
content["thread_url"] = submission.url content["thread_url"] = submission.url

Loading…
Cancel
Save