From 1dec673841914005018306e65109c477425023e9 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 28 May 2023 14:13:16 +0200 Subject: [PATCH] Update all the requirements, reformat a bit and fix the story mode character limit --- reddit/subreddit.py | 15 +-------------- requirements.txt | 26 +++++++++++++------------- utils/imagenarator.py | 6 +++--- utils/subreddit.py | 15 ++++++++++++++- video_creation/final_video.py | 4 ++-- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 6251610..7bf5a8f 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -107,20 +107,7 @@ def get_subreddit_threads(POST_ID: str): if submission is None: return get_subreddit_threads(POST_ID) # submission already done. rerun - if settings.config["settings"]["storymode"]: - if not submission.selftext: - print_substep("You are trying to use story mode on post with no post text") - exit() - else: - # Check for the length of the post text - if len(submission.selftext) > ( - settings.config["settings"]["storymode_max_length"] or 2000 - ): - print_substep( - f"Post is too long ({len(submission.selftext)}), try with a different post. ({settings.config['settings']['storymode_max_length']} character limit)" - ) - exit() - elif not submission.num_comments: + elif not submission.num_comments and settings.config["settings"]["storymode"] == "false": print_substep("No comments found. Skipping.") exit() diff --git a/requirements.txt b/requirements.txt index 4459bd1..e06ff0e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,23 @@ -boto3==1.24.24 -botocore==1.27.24 -gTTS==2.2.4 +boto3==1.26.142 +botocore==1.29.142 +gTTS==2.3.2 moviepy==1.0.3 -playwright==1.23.0 -praw==7.6.1 +playwright==1.34.0 +praw==7.7.0 prawcore~=2.3.0 -requests==2.28.1 +requests==2.31.0 rich==13.3.5 toml==0.10.2 -translators==5.3.1 +translators==5.7.6 pyttsx3==2.90 -Pillow~=9.4.0 +Pillow==9.5.0 tomlkit==0.11.8 Flask==2.3.2 clean-text==0.6.0 -unidecode==1.3.2 -spacy==3.4.1 -torch==1.12.1 -transformers==4.25.1 +unidecode==1.3.6 +spacy==3.5.3 +torch==2.0.1 +transformers==4.29.2 ffmpeg-python==0.2.0 -elevenlabs==0.2.10 +elevenlabs==0.2.16 yt-dlp==2023.3.4 \ No newline at end of file diff --git a/utils/imagenarator.py b/utils/imagenarator.py index 847073c..aabdb2e 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -64,13 +64,13 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) if transparent: - font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 50) - tfont = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 50) + font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) + tfont = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) else: tfont = ImageFont.truetype( os.path.join("fonts", "Roboto-Bold.ttf"), 100 ) # for title - font = ImageFont.truetype(os.path.join("fonts", "Roboto-Regular.ttf"), 90) + font = ImageFont.truetype(os.path.join("fonts", "Roboto-Regular.ttf"), 100) size = (1920, 1080) image = Image.new("RGBA", size, theme) diff --git a/utils/subreddit.py b/utils/subreddit.py index a883e78..43b5d1d 100644 --- a/utils/subreddit.py +++ b/utils/subreddit.py @@ -57,6 +57,19 @@ def get_subreddit_undone( f'This post has under the specified minimum of comments ({settings.config["reddit"]["thread"]["min_comments"]}). Skipping...' ) continue + if settings.config["settings"]["storymode"]: + if not submission.selftext: + print_substep("You are trying to use story mode on post with no post text") + continue + else: + # Check for the length of the post text + if len(submission.selftext) > ( + settings.config["settings"]["storymode_max_length"] or 2000 + ): + print_substep( + f"Post is too long ({len(submission.selftext)}), try with a different post. ({settings.config['settings']['storymode_max_length']} character limit)" + ) + continue if settings.config["settings"]["storymode"] and not submission.is_self: continue if similarity_scores is not None: @@ -73,7 +86,7 @@ def get_subreddit_undone( ] # set doesn't have __getitem__ index = times_checked + 1 if index == len(VALID_TIME_FILTERS): - print("all time filters have been checked you absolute madlad ") + print("All submissions have been done.") return get_subreddit_undone( subreddit.top( diff --git a/video_creation/final_video.py b/video_creation/final_video.py index c322a4c..0246a37 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -377,9 +377,9 @@ def make_final_video( ) old_percentage = pbar.n pbar.update(100 - old_percentage) - if(allowOnlyTTSFolder): + if allowOnlyTTSFolder: path = defaultPath + f"/OnlyTTS/{filename}" - path = path[:251] + ".mp4" #Prevent a error by limiting the path length, do not change this. + path = path[:251] + ".mp4" # Prevent a error by limiting the path length, do not change this. print_step("Rendering the Only TTS Video 🎥") with ProgressFfmpeg(length, on_update_example) as progress: ffmpeg.output(