From 3f32feaa2466cd1136e6c2a1875654032e6ee14c Mon Sep 17 00:00:00 2001 From: Arjun Dureja Date: Fri, 3 Jun 2022 13:51:43 -0400 Subject: [PATCH] add character limit for male voice --- main.py | 4 ++-- reddit/askreddit.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index a394dc0..872362c 100644 --- a/main.py +++ b/main.py @@ -15,9 +15,9 @@ print_markdown( time.sleep(3) -reddit_object = get_askreddit_threads() - load_dotenv() +reddit_object = get_askreddit_threads(os.getenv("VOICE")) + length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) download_screenshots_of_reddit_posts(reddit_object, number_of_comments) download_background() diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 7c7110a..1e3b3b3 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -5,7 +5,7 @@ from dotenv import load_dotenv import os -def get_askreddit_threads(): +def get_askreddit_threads(voice): """ Returns a list of threads from the AskReddit subreddit. """ @@ -32,6 +32,8 @@ def get_askreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: + if voice == "male" and len(top_level_comment.body) > 550: + continue content["comments"].append( { "comment_body": top_level_comment.body,