From 4348c54a246823e0d31114b73fe66147a13836ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:48:28 +0000 Subject: [PATCH 01/94] Bump elevenlabs from 1.3.0 to 1.3.1 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.3.0...v1.3.1) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e6e2e7b..6dcf08f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,6 @@ spacy==3.7.5 torch==2.3.1 transformers==4.41.2 ffmpeg-python==0.2.0 -elevenlabs==1.3.0 +elevenlabs==1.3.1 yt-dlp==2024.5.27 numpy==1.26.4 From fc9a166d39f4ee5ef2adab50bedc15658e08b8eb Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 18 Jun 2024 21:53:48 -0400 Subject: [PATCH 02/94] CHORE: syntactical changes + some pythonic changes and future improvements --- main.py | 17 ++++++++++------- utils/ai_methods.py | 6 +++--- utils/console.py | 2 +- utils/ffmpeg_install.py | 6 +++--- utils/gui_utils.py | 22 ++++++++++++---------- utils/id.py | 10 ++++++---- utils/imagenarator.py | 11 +++++------ utils/settings.py | 4 ++-- video_creation/final_video.py | 7 ++++--- video_creation/screenshot_downloader.py | 3 +-- 10 files changed, 47 insertions(+), 41 deletions(-) diff --git a/main.py b/main.py index 849663d..c2dae3e 100755 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ import sys from os import name from pathlib import Path from subprocess import Popen -from typing import NoReturn +from typing import NoReturn, Dict from prawcore import ResponseException @@ -13,7 +13,7 @@ from utils import settings from utils.cleanup import cleanup from utils.console import print_markdown, print_step, print_substep from utils.ffmpeg_install import ffmpeg_install -from utils.id import id +from utils.id import extract_id from utils.version import checkversion from video_creation.background import ( chop_background, @@ -42,11 +42,14 @@ print_markdown( ) checkversion(__VERSION__) +reddit_id: str +reddit_object: Dict[str, str | list] def main(POST_ID=None) -> None: - global redditid, reddit_object + global reddit_id, reddit_object reddit_object = get_subreddit_threads(POST_ID) - redditid = id(reddit_object) + reddit_id = extract_id(reddit_object) + print_substep(f"Thread ID is {reddit_id}", style="bold blue") length, number_of_comments = save_text_to_mp3(reddit_object) length = math.ceil(length) get_screenshots_of_reddit_posts(reddit_object, number_of_comments) @@ -64,15 +67,15 @@ def run_many(times) -> None: for x in range(1, times + 1): print_step( f'on the {x}{("th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th")[x % 10]} iteration of {times}' - ) # correct 1st 2nd 3rd 4th 5th.... + ) main() Popen("cls" if name == "nt" else "clear", shell=True).wait() def shutdown() -> NoReturn: - if "redditid" in globals(): + if "reddit_id" in globals(): print_markdown("## Clearing temp files") - cleanup(redditid) + cleanup(reddit_id) print("Exiting...") sys.exit() diff --git a/utils/ai_methods.py b/utils/ai_methods.py index e628942..6926a71 100644 --- a/utils/ai_methods.py +++ b/utils/ai_methods.py @@ -12,7 +12,7 @@ def mean_pooling(model_output, attention_mask): ) -# This function sort the given threads based on their total similarity with the given keywords +# This function sorts the given threads based on their total similarity with the given keywords def sort_by_similarity(thread_objects, keywords): # Initialize tokenizer + model. tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-MiniLM-L6-v2") @@ -34,7 +34,7 @@ def sort_by_similarity(thread_objects, keywords): threads_embeddings = model(**encoded_threads) threads_embeddings = mean_pooling(threads_embeddings, encoded_threads["attention_mask"]) - # Keywords inference + # Keyword inference encoded_keywords = tokenizer(keywords, padding=True, truncation=True, return_tensors="pt") with torch.no_grad(): keywords_embeddings = model(**encoded_keywords) @@ -53,7 +53,7 @@ def sort_by_similarity(thread_objects, keywords): similarity_scores, indices = torch.sort(total_scores, descending=True) - threads_sentences = np.array(threads_sentences)[indices.numpy()] + # threads_sentences = np.array(threads_sentences)[indices.numpy()] thread_objects = np.array(thread_objects)[indices.numpy()].tolist() diff --git a/utils/console.py b/utils/console.py index 18c3248..e940100 100644 --- a/utils/console.py +++ b/utils/console.py @@ -102,7 +102,7 @@ def handle_input( user_input = input("").strip() if check_type is not False: try: - isinstance(eval(user_input), check_type) + isinstance(eval(user_input), check_type) # fixme: remove eval return check_type(user_input) except: console.print( diff --git a/utils/ffmpeg_install.py b/utils/ffmpeg_install.py index b2c673d..b41bad6 100644 --- a/utils/ffmpeg_install.py +++ b/utils/ffmpeg_install.py @@ -28,8 +28,8 @@ def ffmpeg_install_windows(): for root, dirs, files in os.walk(ffmpeg_extracted_folder, topdown=False): for file in files: os.remove(os.path.join(root, file)) - for dir in dirs: - os.rmdir(os.path.join(root, dir)) + for directory in dirs: + os.rmdir(os.path.join(root, directory)) os.rmdir(ffmpeg_extracted_folder) # Extract FFmpeg @@ -110,7 +110,7 @@ def ffmpeg_install(): stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) - except FileNotFoundError as e: + except FileNotFoundError: # Check if there's ffmpeg.exe in the current directory if os.path.exists("./ffmpeg.exe"): print( diff --git a/utils/gui_utils.py b/utils/gui_utils.py index f683adf..31c135f 100644 --- a/utils/gui_utils.py +++ b/utils/gui_utils.py @@ -25,7 +25,9 @@ def get_checks(): # Get current config (from config.toml) as dict -def get_config(obj: dict, done={}): +def get_config(obj: dict, done=None): + if done is None: + done = {} for key in obj.keys(): if not isinstance(obj[key], dict): done[key] = obj[key] @@ -44,13 +46,13 @@ def check(value, checks): if not incorrect and "type" in checks: try: - value = eval(checks["type"])(value) + value = eval(checks["type"])(value) # fixme remove eval except Exception: incorrect = True if ( not incorrect and "options" in checks and value not in checks["options"] - ): # FAILSTATE Value is not one of the options + ): # FAILSTATE Value isn't one of the options incorrect = True if ( not incorrect @@ -59,7 +61,7 @@ def check(value, checks): (isinstance(value, str) and re.match(checks["regex"], value) is None) or not isinstance(value, str) ) - ): # FAILSTATE Value doesn't match regex, or has regex but is not a string. + ): # FAILSTATE Value doesn't match regular expression, or has regular expression but isn't a string. incorrect = True if ( @@ -88,17 +90,17 @@ def check(value, checks): return value -# Modify settings (after form is submitted) +# Modify settings (after the form is submitted) def modify_settings(data: dict, config_load, checks: dict): # Modify config settings - def modify_config(obj: dict, name: str, value: any): + def modify_config(obj: dict, config_name: str, value: any): for key in obj.keys(): - if name == key: + if config_name == key: obj[key] = value elif not isinstance(obj[key], dict): continue else: - modify_config(obj[key], name, value) + modify_config(obj[key], config_name, value) # Remove empty/incorrect key-value pairs data = {key: value for key, value in data.items() if value and key in checks.keys()} @@ -158,7 +160,7 @@ def add_background(youtube_uri, filename, citation, position): youtube_uri = f"https://www.youtube.com/watch?v={regex.group(1)}" - # Check if position is valid + # Check if the position is valid if position == "" or position == "center": position = "center" @@ -178,7 +180,7 @@ def add_background(youtube_uri, filename, citation, position): filename = filename.replace(" ", "_") - # Check if background doesn't already exist + # Check if the background doesn't already exist with open("utils/backgrounds.json", "r", encoding="utf-8") as backgrounds: data = json.load(backgrounds) diff --git a/utils/id.py b/utils/id.py index 3d76593..792d9c9 100644 --- a/utils/id.py +++ b/utils/id.py @@ -1,12 +1,14 @@ import re +from typing import Optional from utils.console import print_substep -def id(reddit_obj: dict): +def extract_id(reddit_obj: dict, field: Optional[str] = "thread_id"): """ This function takes a reddit object and returns the post id """ - id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) - print_substep(f"Thread ID is {id}", style="bold blue") - return id + if field not in reddit_obj.keys(): + raise ValueError(f"Field '{field}' not found in reddit object") + reddit_id = re.sub(r"[^\w\s-]", "", reddit_obj[field]) + return reddit_id diff --git a/utils/imagenarator.py b/utils/imagenarator.py index 509882d..2337ddd 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -7,6 +7,7 @@ from rich.progress import track from TTS.engine_wrapper import process_text from utils.fonts import getheight, getsize +from utils.id import extract_id def draw_multiple_line_text( @@ -58,18 +59,16 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> Render Images for video """ texts = reddit_obj["thread_post"] - id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) - + reddit_id = extract_id(reddit_obj) if transparent: font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) else: font = ImageFont.truetype(os.path.join("fonts", "Roboto-Regular.ttf"), 100) + size = (1920, 1080) - - image = Image.new("RGBA", size, theme) - + for idx, text in track(enumerate(texts), "Rendering Image"): image = Image.new("RGBA", size, theme) text = process_text(text, False) draw_multiple_line_text(image, text, font, txtclr, padding, wrap=30, transparent=transparent) - image.save(f"assets/temp/{id}/png/img{idx}.png") + image.save(f"assets/temp/{reddit_id}/png/img{idx}.png") diff --git a/utils/settings.py b/utils/settings.py index 2ebaef3..f6ff75d 100755 --- a/utils/settings.py +++ b/utils/settings.py @@ -30,7 +30,7 @@ def check(value, checks, name): incorrect = True if not incorrect and "type" in checks: try: - value = eval(checks["type"])(value) + value = eval(checks["type"])(value) # fixme remove eval except: incorrect = True @@ -78,7 +78,7 @@ def check(value, checks, name): + str(name) + "[#F7768E bold]=", extra_info=get_check_value("explanation", ""), - check_type=eval(get_check_value("type", "False")), + check_type=eval(get_check_value("type", "False")), # fixme remove eval default=get_check_value("default", NotImplemented), match=get_check_value("regex", ""), err_message=get_check_value("input_error", "Incorrect input"), diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 101d0f7..0118401 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -19,6 +19,7 @@ from utils import settings from utils.cleanup import cleanup from utils.console import print_step, print_substep from utils.fonts import getheight +from utils.id import extract_id from utils.thumbnail import create_thumbnail from utils.videos import save_data @@ -204,7 +205,7 @@ def make_final_video( opacity = settings.config["settings"]["opacity"] - reddit_id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) + reddit_id = extract_id(reddit_obj) allowOnlyTTSFolder: bool = ( settings.config["settings"]["background"]["enable_extra_audio"] @@ -343,8 +344,8 @@ def make_final_video( ) current_time += audio_clips_durations[i] - title = re.sub(r"[^\w\s-]", "", reddit_obj["thread_title"]) - idx = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) + title = extract_id(reddit_obj, "thread_title") + idx = extract_id(reddit_obj) title_thumb = reddit_obj["thread_title"] filename = f"{name_normalize(title)[:251]}" diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 6b56e99..12a844d 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -34,7 +34,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): # ! Make sure the reddit screenshots folder exists Path(f"assets/temp/{reddit_id}/png").mkdir(parents=True, exist_ok=True) - # set the theme and disable non-essential cookies + # set the theme and turn off non-essential cookies if settings.config["settings"]["theme"] == "dark": cookie_file = open("./video_creation/data/cookie-dark-mode.json", encoding="utf-8") bgcolor = (33, 33, 36, 255) @@ -60,7 +60,6 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): transparent = False if storymode and settings.config["settings"]["storymodemethod"] == 1: - # for idx,item in enumerate(reddit_object["thread_post"]): print_substep("Generating images...") return imagemaker( theme=bgcolor, From 9ed8c87b881530c4674f07f5fc26451cf2b35b21 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 01:54:08 +0000 Subject: [PATCH 03/94] fixup: Format Python code with Black --- main.py | 3 ++- utils/console.py | 2 +- utils/imagenarator.py | 4 ++-- utils/settings.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index c2dae3e..3b22dd2 100755 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ import sys from os import name from pathlib import Path from subprocess import Popen -from typing import NoReturn, Dict +from typing import Dict, NoReturn from prawcore import ResponseException @@ -45,6 +45,7 @@ checkversion(__VERSION__) reddit_id: str reddit_object: Dict[str, str | list] + def main(POST_ID=None) -> None: global reddit_id, reddit_object reddit_object = get_subreddit_threads(POST_ID) diff --git a/utils/console.py b/utils/console.py index e940100..a9abf4b 100644 --- a/utils/console.py +++ b/utils/console.py @@ -102,7 +102,7 @@ def handle_input( user_input = input("").strip() if check_type is not False: try: - isinstance(eval(user_input), check_type) # fixme: remove eval + isinstance(eval(user_input), check_type) # fixme: remove eval return check_type(user_input) except: console.print( diff --git a/utils/imagenarator.py b/utils/imagenarator.py index 2337ddd..ad75331 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -64,9 +64,9 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) else: font = ImageFont.truetype(os.path.join("fonts", "Roboto-Regular.ttf"), 100) - + size = (1920, 1080) - + for idx, text in track(enumerate(texts), "Rendering Image"): image = Image.new("RGBA", size, theme) text = process_text(text, False) diff --git a/utils/settings.py b/utils/settings.py index f6ff75d..6b8242b 100755 --- a/utils/settings.py +++ b/utils/settings.py @@ -78,7 +78,7 @@ def check(value, checks, name): + str(name) + "[#F7768E bold]=", extra_info=get_check_value("explanation", ""), - check_type=eval(get_check_value("type", "False")), # fixme remove eval + check_type=eval(get_check_value("type", "False")), # fixme remove eval default=get_check_value("default", NotImplemented), match=get_check_value("regex", ""), err_message=get_check_value("input_error", "Incorrect input"), From 0f98d422ae217b0fcb001301d40151919af80d2f Mon Sep 17 00:00:00 2001 From: RequieMa <57754488+RequieMa@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:35:21 +0800 Subject: [PATCH 04/94] Update elevenlabs.py Change voice_name to name since it seems that elevenlabs changed the attribute name --- TTS/elevenlabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/elevenlabs.py b/TTS/elevenlabs.py index e896621..c1f478e 100644 --- a/TTS/elevenlabs.py +++ b/TTS/elevenlabs.py @@ -35,4 +35,4 @@ class elevenlabs: def randomvoice(self): if self.client is None: self.initialize() - return random.choice(self.client.voices.get_all().voices).voice_name + return random.choice(self.client.voices.get_all().voices).name From 484e0d7fb5df6d5f7aa8e3500e219df7021f2762 Mon Sep 17 00:00:00 2001 From: RequieMa <57754488+RequieMa@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:14:04 +0800 Subject: [PATCH 05/94] Add a dummy random_voice variable function run() in GTTS.py --- TTS/GTTS.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/GTTS.py b/TTS/GTTS.py index bff100f..c493d73 100644 --- a/TTS/GTTS.py +++ b/TTS/GTTS.py @@ -10,7 +10,7 @@ class GTTS: self.max_chars = 5000 self.voices = [] - def run(self, text, filepath): + def run(self, text, filepath, random_voice=False): tts = gTTS( text=text, lang=settings.config["reddit"]["thread"]["post_lang"] or "en", From def55c183fbc0d53ebc62533b3533202a4a34836 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:48:53 +0000 Subject: [PATCH 06/94] Bump pillow from 10.3.0 to 10.4.0 Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.3.0 to 10.4.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/10.3.0...10.4.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6dcf08f..2117fe6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ rich==13.7.1 toml==0.10.2 translators==5.9.2 pyttsx3==2.90 -Pillow==10.3.0 +Pillow==10.4.0 tomlkit==0.12.5 Flask==3.0.3 clean-text==0.6.0 From 36c3c23ae07fc04a6945e806c5ce569cec71d90e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:48:59 +0000 Subject: [PATCH 07/94] Bump transformers from 4.41.2 to 4.42.3 Bumps [transformers](https://github.com/huggingface/transformers) from 4.41.2 to 4.42.3. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.41.2...v4.42.3) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6dcf08f..20913a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 torch==2.3.1 -transformers==4.41.2 +transformers==4.42.3 ffmpeg-python==0.2.0 elevenlabs==1.3.1 yt-dlp==2024.5.27 From e5ae5f68e23cac49dfea98d7b5caac270b157662 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:08:32 +0000 Subject: [PATCH 08/94] Bump yt-dlp from 2024.5.27 to 2024.7.2 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.5.27 to 2024.7.2. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.05.27...2024.07.02) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6dcf08f..77d3636 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.3.1 transformers==4.41.2 ffmpeg-python==0.2.0 elevenlabs==1.3.1 -yt-dlp==2024.5.27 +yt-dlp==2024.7.2 numpy==1.26.4 From 02e55db566be59ab10acd2d66290f2fe65d0f422 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:06:56 +0000 Subject: [PATCH 09/94] Bump tomlkit from 0.12.5 to 0.13.0 Bumps [tomlkit](https://github.com/sdispater/tomlkit) from 0.12.5 to 0.13.0. - [Release notes](https://github.com/sdispater/tomlkit/releases) - [Changelog](https://github.com/python-poetry/tomlkit/blob/master/CHANGELOG.md) - [Commits](https://github.com/sdispater/tomlkit/compare/0.12.5...0.13.0) --- updated-dependencies: - dependency-name: tomlkit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2465218..18b34a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ toml==0.10.2 translators==5.9.2 pyttsx3==2.90 Pillow==10.4.0 -tomlkit==0.12.5 +tomlkit==0.13.0 Flask==3.0.3 clean-text==0.6.0 unidecode==1.3.8 From 487c75900d19bad2c203318c42bcfda685ef0fd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:16:19 +0000 Subject: [PATCH 10/94] Bump transformers from 4.42.3 to 4.42.4 Bumps [transformers](https://github.com/huggingface/transformers) from 4.42.3 to 4.42.4. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.42.3...v4.42.4) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2465218..461db92 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 torch==2.3.1 -transformers==4.42.3 +transformers==4.42.4 ffmpeg-python==0.2.0 elevenlabs==1.3.1 yt-dlp==2024.7.2 From 109d16e722a480a69b5e299c64d09f2eefa84643 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 22:49:46 +0000 Subject: [PATCH 11/94] Bump elevenlabs from 1.3.1 to 1.4.1 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.3.1 to 1.4.1. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.3.1...v1.4.1) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 461db92..5013cb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,6 @@ spacy==3.7.5 torch==2.3.1 transformers==4.42.4 ffmpeg-python==0.2.0 -elevenlabs==1.3.1 +elevenlabs==1.4.1 yt-dlp==2024.7.2 numpy==1.26.4 From 7184da62a87392c0b85c16c9262e0bd37d01855e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 22:56:36 +0000 Subject: [PATCH 12/94] Bump yt-dlp from 2024.7.2 to 2024.7.9 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.7.2 to 2024.7.9. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.07.02...2024.07.09) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8012f01..383c1b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.3.1 transformers==4.42.4 ffmpeg-python==0.2.0 elevenlabs==1.4.1 -yt-dlp==2024.7.2 +yt-dlp==2024.7.9 numpy==1.26.4 From 8872b379df23077f7d8550bcf1aae5d2d1aeb7da Mon Sep 17 00:00:00 2001 From: prafful Date: Mon, 15 Jul 2024 00:16:30 +0530 Subject: [PATCH 13/94] updated readme for improved installation --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e4b7973..1b221db 100644 --- a/README.md +++ b/README.md @@ -37,27 +37,61 @@ The only original thing being done is the editing and gathering of all materials ## Installation 👩‍💻 -1. Clone this repository -2. Run `pip install -r requirements.txt` -3. Run `python -m playwright install` and `python -m playwright install-deps` +1. Clone this repository: + ```sh + git clone https://github.com/elebumm/RedditVideoMakerBot.git + cd RedditVideoMakerBot + ``` + +2. Create and activate a virtual environment: + - On **Windows**: + ```sh + python -m venv venv + venv\Scripts\activate + ``` + - On **macOS and Linux**: + ```sh + python3 -m venv venv + source venv/bin/activate + ``` + +3. Install the required dependencies: + ```sh + pip install -r requirements.txt + ``` + +4. Install Playwright and its dependencies: + ```sh + python -m playwright install + python -m playwright install-deps + ``` + +--- **EXPERIMENTAL!!!!** -On macOS and Linux (debian, arch, fedora and centos, and based on those), you can run an install script that will automatically install steps 1 to 3. (requires bash) + - On macOS and Linux (Debian, Arch, Fedora, CentOS, and based on those), you can run an installation script that will automatically install steps 1 to 3. (requires bash) + - `bash <(curl -sL https://raw.githubusercontent.com/elebumm/RedditVideoMakerBot/master/install.sh)` + - This can also be used to update the installation -`bash <(curl -sL https://raw.githubusercontent.com/elebumm/RedditVideoMakerBot/master/install.sh)` +--- -This can also be used to update the installation +5. Run the bot: + ```sh + python main.py + ``` -4. Run `python main.py` -5. Visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps), and set up an app that is a "script". Paste any URL in redirect URL. Ex:`https://jasoncameron.dev` -6. The bot will ask you to fill in your details to connect to the Reddit API, and configure the bot to your liking -7. Enjoy 😎 -8. If you need to reconfigure the bot, simply open the `config.toml` file and delete the lines that need to be changed. On the next run of the bot, it will help you reconfigure those options. +6. Visit [the Reddit Apps page](https://www.reddit.com/prefs/apps), and set up an app that is a "script". Paste any URL in the redirect URL field, for example: `https://jasoncameron.dev`. -(Note if you got an error installing or running the bot try first rerunning the command with a three after the name e.g. python3 or pip3) +7. The bot will prompt you to fill in your details to connect to the Reddit API and configure the bot to your liking. -If you want to read more detailed guide about the bot, please refer to the [documentation](https://reddit-video-maker-bot.netlify.app/) +8. Enjoy 😎 + +9. If you need to reconfigure the bot, simply open the `config.toml` file and delete the lines that need to be changed. On the next run of the bot, it will help you reconfigure those options. + +(Note: If you encounter any errors installing or running the bot, try using `python3` or `pip3` instead of `python` or `pip`.) + +For a more detailed guide about the bot, please refer to the [documentation](https://reddit-video-maker-bot.netlify.app/). ## Video From aecb7644bef71d6d0c536a1ac6ec5194ebb764f6 Mon Sep 17 00:00:00 2001 From: prafful Date: Mon, 15 Jul 2024 00:50:59 +0530 Subject: [PATCH 14/94] updated to ./venv --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1b221db..8825639 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,13 @@ The only original thing being done is the editing and gathering of all materials 2. Create and activate a virtual environment: - On **Windows**: ```sh - python -m venv venv - venv\Scripts\activate + python -m venv ./venv + .\venv\Scripts\activate ``` - On **macOS and Linux**: ```sh - python3 -m venv venv - source venv/bin/activate + python3 -m venv ./venv + source ./venv/bin/activate ``` 3. Install the required dependencies: From 72994d48ac84b05059dba0b6a4ab502ed6e7406a Mon Sep 17 00:00:00 2001 From: prafful Date: Mon, 15 Jul 2024 12:48:43 +0530 Subject: [PATCH 15/94] updated dockerignore for ignoring results folder --- .dockerignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 1d1fe94..1653ff2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ -Dockerfile \ No newline at end of file +Dockerfile +results \ No newline at end of file From 9cc022f4b578a8348a2e88dea94776b6d7cbecc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:48:56 +0000 Subject: [PATCH 16/94] Bump elevenlabs from 1.4.1 to 1.5.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.4.1 to 1.5.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.4.1...v1.5.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 383c1b7..e3ff49d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,6 @@ spacy==3.7.5 torch==2.3.1 transformers==4.42.4 ffmpeg-python==0.2.0 -elevenlabs==1.4.1 +elevenlabs==1.5.0 yt-dlp==2024.7.9 numpy==1.26.4 From 6c1bf32fc5fba43937277f4dbe26495a6dcad64b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:02:04 +0000 Subject: [PATCH 17/94] Bump gtts from 2.5.1 to 2.5.2 Bumps [gtts](https://github.com/pndurette/gTTS) from 2.5.1 to 2.5.2. - [Release notes](https://github.com/pndurette/gTTS/releases) - [Changelog](https://github.com/pndurette/gTTS/blob/main/CHANGELOG.md) - [Commits](https://github.com/pndurette/gTTS/compare/v2.5.1...v2.5.2) --- updated-dependencies: - dependency-name: gtts dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 383c1b7..ee902f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ boto3==1.34.127 botocore==1.34.127 -gTTS==2.5.1 +gTTS==2.5.2 moviepy==1.0.3 playwright==1.44.0 praw==7.7.1 From 7a2d2c918f155ff66c1917873dc36578e68a0c0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:32:37 +0000 Subject: [PATCH 18/94] Bump transformers from 4.42.4 to 4.43.2 Bumps [transformers](https://github.com/huggingface/transformers) from 4.42.4 to 4.43.2. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.42.4...v4.43.2) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 383c1b7..e3670a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 torch==2.3.1 -transformers==4.42.4 +transformers==4.43.2 ffmpeg-python==0.2.0 elevenlabs==1.4.1 yt-dlp==2024.7.9 From 45960fceedb69e94ecb3c2caa23a3d1f1cfc3a32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 02:03:56 +0000 Subject: [PATCH 19/94] Bump yt-dlp from 2024.7.9 to 2024.7.25 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.7.9 to 2024.7.25. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.07.09...2024.07.25) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3973312..bbdb409 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.3.1 transformers==4.43.2 ffmpeg-python==0.2.0 elevenlabs==1.5.0 -yt-dlp==2024.7.9 +yt-dlp==2024.7.25 numpy==1.26.4 From b8c94f083b4685fdb4b1b10e88cb5d799ab48a41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 02:04:05 +0000 Subject: [PATCH 20/94] Bump torch from 2.3.1 to 2.4.0 Bumps [torch](https://github.com/pytorch/pytorch) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.3.1...v2.4.0) --- updated-dependencies: - dependency-name: torch dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3973312..fc9fda3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ Flask==3.0.3 clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 -torch==2.3.1 +torch==2.4.0 transformers==4.43.2 ffmpeg-python==0.2.0 elevenlabs==1.5.0 From 25fcf2a5ece4f5abec033b2a4e61f6578600afff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 10:17:54 +0000 Subject: [PATCH 21/94] Bump elevenlabs from 1.5.0 to 1.7.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.5.0 to 1.7.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.5.0...v1.7.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 41f2fe5..f7f9364 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,6 @@ spacy==3.7.5 torch==2.4.0 transformers==4.43.2 ffmpeg-python==0.2.0 -elevenlabs==1.5.0 +elevenlabs==1.7.0 yt-dlp==2024.7.25 numpy==1.26.4 From ba2791aa9df17410a6112d9b352b18cbe704a540 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:31:29 +0000 Subject: [PATCH 22/94] Bump tomlkit from 0.13.0 to 0.13.2 Bumps [tomlkit](https://github.com/sdispater/tomlkit) from 0.13.0 to 0.13.2. - [Release notes](https://github.com/sdispater/tomlkit/releases) - [Changelog](https://github.com/python-poetry/tomlkit/blob/master/CHANGELOG.md) - [Commits](https://github.com/sdispater/tomlkit/compare/0.13.0...0.13.2) --- updated-dependencies: - dependency-name: tomlkit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 41f2fe5..9a5d0d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ toml==0.10.2 translators==5.9.2 pyttsx3==2.90 Pillow==10.4.0 -tomlkit==0.13.0 +tomlkit==0.13.2 Flask==3.0.3 clean-text==0.6.0 unidecode==1.3.8 From 1a3a8613d7662274c2cecbbe7130a39c35778e86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:31:31 +0000 Subject: [PATCH 23/94] Bump gtts from 2.5.2 to 2.5.3 Bumps [gtts](https://github.com/pndurette/gTTS) from 2.5.2 to 2.5.3. - [Release notes](https://github.com/pndurette/gTTS/releases) - [Changelog](https://github.com/pndurette/gTTS/blob/main/CHANGELOG.md) - [Commits](https://github.com/pndurette/gTTS/compare/v2.5.2...v2.5.3) --- updated-dependencies: - dependency-name: gtts dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 41f2fe5..1380f7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ boto3==1.34.127 botocore==1.34.127 -gTTS==2.5.2 +gTTS==2.5.3 moviepy==1.0.3 playwright==1.44.0 praw==7.7.1 From 8bbabcc54e4b3ec57cb888c4a7adb2c526b33e79 Mon Sep 17 00:00:00 2001 From: "M. Sanaullah" Date: Sun, 18 Aug 2024 01:13:03 +0500 Subject: [PATCH 24/94] Update final_video.py Dynamically change the title card size based on the "Reddit" title lenght --- video_creation/final_video.py | 87 +++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 101d0f7..641b6ba 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -108,19 +108,60 @@ def prepare_background(reddit_id: str, W: int, H: int) -> str: return output_path +def get_text_height(draw, text, font, max_width): + lines = textwrap.wrap(text, width=max_width) + total_height = 0 + for line in lines: + _, _, _, height = draw.textbbox((0, 0), line, font=font) + total_height += height + return total_height + def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): + """ + It will take the 1px from the middle of the template and will be resized (stretched) vertically to accommodate the extra height needed for the title. + """ print_step(f"Creating fancy thumbnail for: {text}") font_title_size = 47 font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), font_title_size) image_width, image_height = image.size - lines = textwrap.wrap(text, width=wrap) - y = ( - (image_height / 2) - - (((getheight(font, text) + (len(lines) * padding) / len(lines)) * len(lines)) / 2) - + 30 - ) + + # Calculate text height to determine new image height draw = ImageDraw.Draw(image) + text_height = get_text_height(draw, text, font, wrap) + lines = textwrap.wrap(text, width=wrap) + # This are -50 to reduce the empty space at the bottom of the image, + # change it as per your requirement if needed otherwise leave it. + new_image_height = image_height + text_height + padding * (len(lines) - 1) - 50 + + # Separate the image into top, middle (1px), and bottom parts + top_part_height = image_height // 2 + middle_part_height = 1 # 1px height middle section + bottom_part_height = image_height - top_part_height - middle_part_height + + top_part = image.crop((0, 0, image_width, top_part_height)) + middle_part = image.crop((0, top_part_height, image_width, top_part_height + middle_part_height)) + bottom_part = image.crop((0, top_part_height + middle_part_height, image_width, image_height)) + + # Stretch the middle part + new_middle_height = new_image_height - top_part_height - bottom_part_height + middle_part = middle_part.resize((image_width, new_middle_height)) + + # Create new image with the calculated height + new_image = Image.new("RGBA", (image_width, new_image_height)) + + # Paste the top, stretched middle, and bottom parts into the new image + new_image.paste(top_part, (0, 0)) + new_image.paste(middle_part, (0, top_part_height)) + new_image.paste(bottom_part, (0, top_part_height + new_middle_height)) + + # Draw the title text on the new image + draw = ImageDraw.Draw(new_image) + y = top_part_height + padding + for line in lines: + draw.text((120, y), line, font=font, fill=text_color, align="left") + y += get_text_height(draw, line, font, wrap) + padding + # Draw the username "PlotPulse" at the specific position username_font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 30) draw.text( (205, 825), @@ -130,39 +171,7 @@ def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): align="left", ) - if len(lines) == 3: - lines = textwrap.wrap(text, width=wrap + 10) - font_title_size = 40 - font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), font_title_size) - y = ( - (image_height / 2) - - (((getheight(font, text) + (len(lines) * padding) / len(lines)) * len(lines)) / 2) - + 35 - ) - elif len(lines) == 4: - lines = textwrap.wrap(text, width=wrap + 10) - font_title_size = 35 - font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), font_title_size) - y = ( - (image_height / 2) - - (((getheight(font, text) + (len(lines) * padding) / len(lines)) * len(lines)) / 2) - + 40 - ) - elif len(lines) > 4: - lines = textwrap.wrap(text, width=wrap + 10) - font_title_size = 30 - font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), font_title_size) - y = ( - (image_height / 2) - - (((getheight(font, text) + (len(lines) * padding) / len(lines)) * len(lines)) / 2) - + 30 - ) - - for line in lines: - draw.text((120, y), line, font=font, fill=text_color, align="left") - y += getheight(font, line) + padding - - return image + return new_image def merge_background_audio(audio: ffmpeg, reddit_id: str): From 1eed8997566c4a7b4f3092a875dc4ce1bce1071e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:26:08 +0000 Subject: [PATCH 25/94] Bump transformers from 4.43.2 to 4.44.2 Bumps [transformers](https://github.com/huggingface/transformers) from 4.43.2 to 4.44.2. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.43.2...v4.44.2) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 41f2fe5..ca7854f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 torch==2.4.0 -transformers==4.43.2 +transformers==4.44.2 ffmpeg-python==0.2.0 elevenlabs==1.5.0 yt-dlp==2024.7.25 From 29ea86214953f52b3cde2f52e7aed1dce7e67e19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:54:12 +0000 Subject: [PATCH 26/94] Bump pyttsx3 from 2.90 to 2.91 Bumps [pyttsx3](https://github.com/nateshmbhat/pyttsx3) from 2.90 to 2.91. - [Release notes](https://github.com/nateshmbhat/pyttsx3/releases) - [Commits](https://github.com/nateshmbhat/pyttsx3/compare/v.2.90...v2.91) --- updated-dependencies: - dependency-name: pyttsx3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 41f2fe5..17cceb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests==2.32.3 rich==13.7.1 toml==0.10.2 translators==5.9.2 -pyttsx3==2.90 +pyttsx3==2.91 Pillow==10.4.0 tomlkit==0.13.0 Flask==3.0.3 From ff8409d2422de38b5323f70bcdc7a902fa19df39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:07:31 +0000 Subject: [PATCH 27/94] Bump rich from 13.7.1 to 13.8.0 Bumps [rich](https://github.com/Textualize/rich) from 13.7.1 to 13.8.0. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.7.1...v13.8.0) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cbd2c2b..4ef6687 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ playwright==1.44.0 praw==7.7.1 prawcore~=2.3.0 requests==2.32.3 -rich==13.7.1 +rich==13.8.0 toml==0.10.2 translators==5.9.2 pyttsx3==2.91 From 9d8b58fd97dda28f9edd2a14b584d162c6c2b3da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 10:38:00 +0000 Subject: [PATCH 28/94] Bump torch from 2.4.0 to 2.4.1 Bumps [torch](https://github.com/pytorch/pytorch) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.4.0...v2.4.1) --- updated-dependencies: - dependency-name: torch dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cbd2c2b..5e23e8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ Flask==3.0.3 clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.5 -torch==2.4.0 +torch==2.4.1 transformers==4.44.2 ffmpeg-python==0.2.0 elevenlabs==1.7.0 From d316f0f33022e7faf539878d9f85940b3349c341 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2024 06:38:11 +0000 Subject: [PATCH 29/94] Bump spacy from 3.7.5 to 3.7.6 Bumps [spacy](https://github.com/explosion/spaCy) from 3.7.5 to 3.7.6. - [Release notes](https://github.com/explosion/spaCy/releases) - [Commits](https://github.com/explosion/spaCy/compare/v3.7.5...release-v3.7.6) --- updated-dependencies: - dependency-name: spacy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9623d8a..1861ad1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ tomlkit==0.13.2 Flask==3.0.3 clean-text==0.6.0 unidecode==1.3.8 -spacy==3.7.5 +spacy==3.7.6 torch==2.4.1 transformers==4.44.2 ffmpeg-python==0.2.0 From 559bb41943784d5a717a44a3d3a4b7b30710add5 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2024 06:54:04 +0000 Subject: [PATCH 30/94] fixup: Format Python code with Black --- video_creation/final_video.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 1fa4d4a..85a0c1f 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -117,6 +117,7 @@ def get_text_height(draw, text, font, max_width): total_height += height return total_height + def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): """ It will take the 1px from the middle of the template and will be resized (stretched) vertically to accommodate the extra height needed for the title. @@ -130,7 +131,7 @@ def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): draw = ImageDraw.Draw(image) text_height = get_text_height(draw, text, font, wrap) lines = textwrap.wrap(text, width=wrap) - # This are -50 to reduce the empty space at the bottom of the image, + # This are -50 to reduce the empty space at the bottom of the image, # change it as per your requirement if needed otherwise leave it. new_image_height = image_height + text_height + padding * (len(lines) - 1) - 50 From 134ae6521d8db6ec21e7c8db38d2055523a26e15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:32:38 +0000 Subject: [PATCH 31/94] Bump rich from 13.8.0 to 13.8.1 Bumps [rich](https://github.com/Textualize/rich) from 13.8.0 to 13.8.1. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.8.0...v13.8.1) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1861ad1..929662e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ playwright==1.44.0 praw==7.7.1 prawcore~=2.3.0 requests==2.32.3 -rich==13.8.0 +rich==13.8.1 toml==0.10.2 translators==5.9.2 pyttsx3==2.91 From 8be9378eb8d4e70fdef54e1fd564cc99e23e9aeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:32:14 +0000 Subject: [PATCH 32/94] Bump pyttsx3 from 2.91 to 2.97 Bumps [pyttsx3](https://github.com/nateshmbhat/pyttsx3) from 2.91 to 2.97. - [Release notes](https://github.com/nateshmbhat/pyttsx3/releases) - [Commits](https://github.com/nateshmbhat/pyttsx3/commits) --- updated-dependencies: - dependency-name: pyttsx3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1861ad1..7d0acea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests==2.32.3 rich==13.8.0 toml==0.10.2 translators==5.9.2 -pyttsx3==2.91 +pyttsx3==2.97 Pillow==10.4.0 tomlkit==0.13.2 Flask==3.0.3 From df86befa9841a064c60e77e7f6165427b0492369 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:32:20 +0000 Subject: [PATCH 33/94] Bump elevenlabs from 1.7.0 to 1.8.1 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.7.0 to 1.8.1. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.7.0...v1.8.1) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1861ad1..e00b46f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,6 @@ spacy==3.7.6 torch==2.4.1 transformers==4.44.2 ffmpeg-python==0.2.0 -elevenlabs==1.7.0 +elevenlabs==1.8.1 yt-dlp==2024.7.25 numpy==1.26.4 From b25f424579924acbfbf376e7d7c6bcb57e26252f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:50:59 +0000 Subject: [PATCH 34/94] Bump yt-dlp from 2024.7.25 to 2024.9.27 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.7.25 to 2024.9.27. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.07.25...2024.09.27) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index da7f543..f62b9a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.44.2 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2024.7.25 +yt-dlp==2024.9.27 numpy==1.26.4 From eb5700499de82c763e48428340db6f26c85676a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:51:03 +0000 Subject: [PATCH 35/94] Bump translators from 5.9.2 to 5.9.3 Bumps [translators](https://github.com/UlionTse/translators) from 5.9.2 to 5.9.3. - [Changelog](https://github.com/UlionTse/translators/blob/master/README_history.md) - [Commits](https://github.com/UlionTse/translators/commits) --- updated-dependencies: - dependency-name: translators dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index da7f543..2c5264d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ prawcore~=2.3.0 requests==2.32.3 rich==13.8.1 toml==0.10.2 -translators==5.9.2 +translators==5.9.3 pyttsx3==2.97 Pillow==10.4.0 tomlkit==0.13.2 From 328692e1f2a62af61ac6ce33a6ddda917b119904 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 05:09:50 +0000 Subject: [PATCH 36/94] Bump pyttsx3 from 2.97 to 2.98 Bumps [pyttsx3](https://github.com/nateshmbhat/pyttsx3) from 2.97 to 2.98. - [Release notes](https://github.com/nateshmbhat/pyttsx3/releases) - [Commits](https://github.com/nateshmbhat/pyttsx3/commits) --- updated-dependencies: - dependency-name: pyttsx3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d7be4b5..f8b5a03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests==2.32.3 rich==13.8.1 toml==0.10.2 translators==5.9.3 -pyttsx3==2.97 +pyttsx3==2.98 Pillow==10.4.0 tomlkit==0.13.2 Flask==3.0.3 From a1d425926a941a4ec7a08cfe1c33200be731ae14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:33:56 +0000 Subject: [PATCH 37/94] Bump rich from 13.8.1 to 13.9.1 Bumps [rich](https://github.com/Textualize/rich) from 13.8.1 to 13.9.1. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.8.1...v13.9.1) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d7be4b5..5492a34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ playwright==1.44.0 praw==7.7.1 prawcore~=2.3.0 requests==2.32.3 -rich==13.8.1 +rich==13.9.1 toml==0.10.2 translators==5.9.3 pyttsx3==2.97 From 12892314a0b9e5c8e912e6a54d9cce4203d1e7be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:31:54 +0000 Subject: [PATCH 38/94] Bump rich from 13.9.1 to 13.9.2 Bumps [rich](https://github.com/Textualize/rich) from 13.9.1 to 13.9.2. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.9.1...v13.9.2) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 021d2e7..9ddb97a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ playwright==1.44.0 praw==7.7.1 prawcore~=2.3.0 requests==2.32.3 -rich==13.9.1 +rich==13.9.2 toml==0.10.2 translators==5.9.3 pyttsx3==2.98 From 7991d981768932d15d8047acf963c4dc92ef5590 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:21:45 +0000 Subject: [PATCH 39/94] Bump yt-dlp from 2024.9.27 to 2024.10.7 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.9.27 to 2024.10.7. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.09.27...2024.10.07) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 021d2e7..c4e5a0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.44.2 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2024.9.27 +yt-dlp==2024.10.7 numpy==1.26.4 From f60b46ccfcfe8ac5b13a8d7df60b9fd3ad54eac9 Mon Sep 17 00:00:00 2001 From: embee Date: Sun, 3 Nov 2024 16:52:43 +0000 Subject: [PATCH 40/94] Update Playwright version requirement, add support for python 3.12.X --- main.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 849663d..3b0cbb6 100755 --- a/main.py +++ b/main.py @@ -79,7 +79,7 @@ def shutdown() -> NoReturn: if __name__ == "__main__": - if sys.version_info.major != 3 or sys.version_info.minor not in [10, 11]: + if sys.version_info.major != 3 or sys.version_info.minor not in [10, 11, 12]: print( "Hey! Congratulations, you've made it so far (which is pretty rare with no Python 3.10). Unfortunately, this program only works on Python 3.10. Please install Python 3.10 and try again." ) diff --git a/requirements.txt b/requirements.txt index e6e2e7b..6dec6c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ boto3==1.34.127 botocore==1.34.127 gTTS==2.5.1 moviepy==1.0.3 -playwright==1.44.0 +playwright==1.48.0 praw==7.7.1 prawcore~=2.3.0 requests==2.32.3 From d483d85834db8b6bfc517bd641338b9654bcbaa0 Mon Sep 17 00:00:00 2001 From: Rodrigo <55567123+rodrigodasilv@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:59:47 -0300 Subject: [PATCH 41/94] Fixed GTTS argument error 'random_voice' --- TTS/engine_wrapper.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 6d498d2..b3f9ac2 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -144,11 +144,18 @@ class TTSEngine: print("OSError") def call_tts(self, filename: str, text: str): - self.tts_module.run( - text, - filepath=f"{self.path}/{filename}.mp3", - random_voice=settings.config["settings"]["tts"]["random_voice"], - ) + if settings.config["settings"]["tts"]["voice_choice"] == "googletranslate": + # GTTS does not have the argument 'random_voice' + self.tts_module.run( + text, + filepath=f"{self.path}/{filename}.mp3", + ) + else: + self.tts_module.run( + text, + filepath=f"{self.path}/{filename}.mp3", + random_voice=settings.config["settings"]["tts"]["random_voice"], + ) # try: # self.length += MP3(f"{self.path}/{filename}.mp3").info.length # except (MutagenError, HeaderNotFoundError): From 884fe1dbc989ff9eea5e7022560c0ff11c70c1fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:19:48 +0000 Subject: [PATCH 42/94] Bump transformers from 4.44.2 to 4.46.2 Bumps [transformers](https://github.com/huggingface/transformers) from 4.44.2 to 4.46.2. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.44.2...v4.46.2) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 95fa560..cc77738 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.6 torch==2.4.1 -transformers==4.44.2 +transformers==4.46.2 ffmpeg-python==0.2.0 elevenlabs==1.8.1 yt-dlp==2024.10.7 From 2e3d565d0e33c76ef251137056b9d6eb9fade52f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:47:40 +0000 Subject: [PATCH 43/94] Bump gtts from 2.5.3 to 2.5.4 Bumps [gtts](https://github.com/pndurette/gTTS) from 2.5.3 to 2.5.4. - [Release notes](https://github.com/pndurette/gTTS/releases) - [Changelog](https://github.com/pndurette/gTTS/blob/main/CHANGELOG.md) - [Commits](https://github.com/pndurette/gTTS/compare/v2.5.3...v2.5.4) --- updated-dependencies: - dependency-name: gtts dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cc77738..93695a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ boto3==1.34.127 botocore==1.34.127 -gTTS==2.5.3 +gTTS==2.5.4 moviepy==1.0.3 playwright==1.44.0 praw==7.7.1 From 33bcf58302fa9305de8abdad20217d859dbfcf5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:47:43 +0000 Subject: [PATCH 44/94] Bump flask from 3.0.3 to 3.1.0 Bumps [flask](https://github.com/pallets/flask) from 3.0.3 to 3.1.0. - [Release notes](https://github.com/pallets/flask/releases) - [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/flask/compare/3.0.3...3.1.0) --- updated-dependencies: - dependency-name: flask dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cc77738..0763196 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ translators==5.9.3 pyttsx3==2.98 Pillow==10.4.0 tomlkit==0.13.2 -Flask==3.0.3 +Flask==3.1.0 clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.6 From eae3d65fa7dd109602204d19c87ac1bcf851f194 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:32:31 +0000 Subject: [PATCH 45/94] Bump praw from 7.7.1 to 7.8.1 Bumps [praw](https://github.com/praw-dev/praw) from 7.7.1 to 7.8.1. - [Release notes](https://github.com/praw-dev/praw/releases) - [Changelog](https://github.com/praw-dev/praw/blob/master/CHANGES.rst) - [Commits](https://github.com/praw-dev/praw/compare/v7.7.1...v7.8.1) --- updated-dependencies: - dependency-name: praw dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9df7d0d..e14db5a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ botocore==1.34.127 gTTS==2.5.4 moviepy==1.0.3 playwright==1.44.0 -praw==7.7.1 +praw==7.8.1 prawcore~=2.3.0 requests==2.32.3 rich==13.9.2 From 59a287d69d8960e996135cc84c2d86910a00e094 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:03:06 +0000 Subject: [PATCH 46/94] Bump rich from 13.9.2 to 13.9.4 Bumps [rich](https://github.com/Textualize/rich) from 13.9.2 to 13.9.4. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.9.2...v13.9.4) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e14db5a..2ae31a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ playwright==1.44.0 praw==7.8.1 prawcore~=2.3.0 requests==2.32.3 -rich==13.9.2 +rich==13.9.4 toml==0.10.2 translators==5.9.3 pyttsx3==2.98 From 0caae7884432e8ca989baaee2774b455fa735fe1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:28:39 +0000 Subject: [PATCH 47/94] Bump transformers from 4.46.2 to 4.46.3 Bumps [transformers](https://github.com/huggingface/transformers) from 4.46.2 to 4.46.3. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.46.2...v4.46.3) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ae2cabb..651f10d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.7.6 torch==2.4.1 -transformers==4.46.2 +transformers==4.46.3 ffmpeg-python==0.2.0 elevenlabs==1.8.1 yt-dlp==2024.10.7 From 3cf1a93d7964ba0bcde0acfb1c323d837bdefbde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:50:19 +0000 Subject: [PATCH 48/94] Bump yt-dlp from 2024.10.7 to 2024.12.13 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.10.7 to 2024.12.13. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.10.07...2024.12.13) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 651f10d..d02ee78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.46.3 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2024.10.7 +yt-dlp==2024.12.13 numpy==1.26.4 From 45dda35cda7cc1693ba463ea2ac86c4ec0b6db5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:38:01 +0000 Subject: [PATCH 49/94] Bump spacy from 3.7.6 to 3.8.3 Bumps [spacy](https://github.com/explosion/spaCy) from 3.7.6 to 3.8.3. - [Release notes](https://github.com/explosion/spaCy/releases) - [Commits](https://github.com/explosion/spaCy/compare/release-v3.7.6...release-v3.8.3) --- updated-dependencies: - dependency-name: spacy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 651f10d..4dcd567 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ tomlkit==0.13.2 Flask==3.1.0 clean-text==0.6.0 unidecode==1.3.8 -spacy==3.7.6 +spacy==3.8.3 torch==2.4.1 transformers==4.46.3 ffmpeg-python==0.2.0 From a7c6679ddeb25609cfcba02c3ea53c94650c8960 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 21:26:01 +0000 Subject: [PATCH 50/94] Bump transformers from 4.46.3 to 4.47.1 Bumps [transformers](https://github.com/huggingface/transformers) from 4.46.3 to 4.47.1. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.46.3...v4.47.1) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 62675c0..7fa7084 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.3 torch==2.4.1 -transformers==4.46.3 +transformers==4.47.1 ffmpeg-python==0.2.0 elevenlabs==1.8.1 yt-dlp==2024.12.13 From 7f2f024c30453bd3d41974d8df546dfd8e83586e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Dec 2024 10:27:51 +0000 Subject: [PATCH 51/94] Bump yt-dlp from 2024.12.13 to 2024.12.23 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.12.13 to 2024.12.23. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.12.13...2024.12.23) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 62675c0..860c13b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.46.3 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2024.12.13 +yt-dlp==2024.12.23 numpy==1.26.4 From 5b16489525a7c316c48d92b98dfdfb04bf4546ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:13:30 +0000 Subject: [PATCH 52/94] Bump yt-dlp from 2024.12.23 to 2025.1.12 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2024.12.23 to 2025.1.12. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2024.12.23...2025.01.12) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 029cd30..eef9fe3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.47.1 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2024.12.23 +yt-dlp==2025.1.12 numpy==1.26.4 From 9515b078f2630661275c57dc6f09a653946379b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:13:35 +0000 Subject: [PATCH 53/94] Bump transformers from 4.47.1 to 4.48.0 Bumps [transformers](https://github.com/huggingface/transformers) from 4.47.1 to 4.48.0. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.47.1...v4.48.0) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 029cd30..b92e97d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.3 torch==2.4.1 -transformers==4.47.1 +transformers==4.48.0 ffmpeg-python==0.2.0 elevenlabs==1.8.1 yt-dlp==2024.12.23 From 4600936add53566a10945c672f94d27990f4f335 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 00:03:24 +0000 Subject: [PATCH 54/94] Bump yt-dlp from 2025.1.12 to 2025.1.15 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2025.1.12 to 2025.1.15. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2025.01.12...2025.01.15) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5f65df3..5a37eae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.48.0 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2025.1.12 +yt-dlp==2025.1.15 numpy==1.26.4 From 20640fd5626aa7ea878b2ed6dad93bb59c84ed91 Mon Sep 17 00:00:00 2001 From: tkhmielnitzky Date: Sun, 19 Jan 2025 15:27:07 +0100 Subject: [PATCH 55/94] Add optional random_voice parameter to run method --- TTS/GTTS.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/GTTS.py b/TTS/GTTS.py index bff100f..2e2d530 100644 --- a/TTS/GTTS.py +++ b/TTS/GTTS.py @@ -10,7 +10,7 @@ class GTTS: self.max_chars = 5000 self.voices = [] - def run(self, text, filepath): + def run(self, text, filepath, random_voice: bool = False): tts = gTTS( text=text, lang=settings.config["reddit"]["thread"]["post_lang"] or "en", From dc76ae6c785bb2adabe33587a0c73507ea60f1c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:25:11 +0000 Subject: [PATCH 56/94] Bump transformers from 4.48.0 to 4.48.1 Bumps [transformers](https://github.com/huggingface/transformers) from 4.48.0 to 4.48.1. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.48.0...v4.48.1) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5a37eae..fcc996d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.3 torch==2.4.1 -transformers==4.48.0 +transformers==4.48.1 ffmpeg-python==0.2.0 elevenlabs==1.8.1 yt-dlp==2025.1.15 From a9fbb97da00394dea0941cbfac5d6146db08ee6d Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Tue, 21 Jan 2025 14:55:36 -0500 Subject: [PATCH 57/94] chore: update version --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index affcf5e..4e80a6e 100755 --- a/main.py +++ b/main.py @@ -25,7 +25,7 @@ from video_creation.final_video import make_final_video from video_creation.screenshot_downloader import get_screenshots_of_reddit_posts from video_creation.voices import save_text_to_mp3 -__VERSION__ = "3.3.0" +__VERSION__ = "3.4.0" print( """ From c3c17ad956721e870c32621efc5fa7f5a49c5e6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:35:14 +0000 Subject: [PATCH 58/94] Bump translators from 5.9.3 to 5.9.5 Bumps [translators](https://github.com/UlionTse/translators) from 5.9.3 to 5.9.5. - [Changelog](https://github.com/UlionTse/translators/blob/master/README_history.md) - [Commits](https://github.com/UlionTse/translators/commits) --- updated-dependencies: - dependency-name: translators dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fcc996d..3fe42f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ prawcore~=2.3.0 requests==2.32.3 rich==13.9.4 toml==0.10.2 -translators==5.9.3 +translators==5.9.5 pyttsx3==2.98 Pillow==10.4.0 tomlkit==0.13.2 From bc2137a84ba2d324ed638027db4b890019724a7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:35:20 +0000 Subject: [PATCH 59/94] Bump yt-dlp from 2025.1.15 to 2025.1.26 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2025.1.15 to 2025.1.26. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2025.01.15...2025.01.26) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fcc996d..db8f77c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,5 +20,5 @@ torch==2.4.1 transformers==4.48.1 ffmpeg-python==0.2.0 elevenlabs==1.8.1 -yt-dlp==2025.1.15 +yt-dlp==2025.1.26 numpy==1.26.4 From b573c50dc76e8bb8d904453d1082ad7c1f0a1276 Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Wed, 29 Jan 2025 00:10:03 -0500 Subject: [PATCH 60/94] chore: Set Python version to 3.10 and remove prawcore Signed-off-by: Jason Cameron --- .python-version | 1 + requirements.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..c8cfe39 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10 diff --git a/requirements.txt b/requirements.txt index 49567b5..d034277 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ gTTS==2.5.4 moviepy==1.0.3 playwright==1.48.0 praw==7.8.1 -prawcore~=2.3.0 requests==2.32.3 rich==13.9.4 toml==0.10.2 From 392b8aed91a2e22498ada79d6ca74af03b457aca Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Wed, 29 Jan 2025 00:43:32 -0500 Subject: [PATCH 61/94] fix(praw): Bypass reddit bot detection fixes: #2228 Signed-off-by: Jason Cameron --- video_creation/screenshot_downloader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 12a844d..a75f1bb 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -81,11 +81,12 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): dsf = (W // 600) + 1 context = browser.new_context( - locale=lang or "en-us", + locale=lang or "en-CA,en;q=0.9", color_scheme="dark", viewport=ViewportSize(width=W, height=H), device_scale_factor=dsf, - user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", + user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", + extra_http_headers={"Dnt": "1", "Sec-Ch-Ua": '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"' }, ) cookies = json.load(cookie_file) cookie_file.close() From 5c72771c5a2dad747b7abe12e98ddc32f8e4f443 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 05:43:58 +0000 Subject: [PATCH 62/94] fixup: Format Python code with Black --- video_creation/screenshot_downloader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index a75f1bb..2e0b4be 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -86,7 +86,10 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): viewport=ViewportSize(width=W, height=H), device_scale_factor=dsf, user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", - extra_http_headers={"Dnt": "1", "Sec-Ch-Ua": '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"' }, + extra_http_headers={ + "Dnt": "1", + "Sec-Ch-Ua": '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"', + }, ) cookies = json.load(cookie_file) cookie_file.close() From 943814150cf696cd628006484f1089cb1cccca3b Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Wed, 29 Jan 2025 01:13:28 -0500 Subject: [PATCH 63/94] feat: Update moviepy to 2.0 (develop) Update moviepy to 2.0 and other dependencies. - Updated moviepy to 2.1.2. - Updated other dependencies such as Pillow, torch, boto3, botocore, playwright, and elevenlabs. - Replaced `volumex` with `MultiplyVolume`. - Replaced `make_frame` with `frame_function`. - Removed verbose and logger arguments where deprecated. - Used `subclipped` instead of `subclip`. - Changed video processing to use context manager to open video files, addressing ffmpeg issues. - Removed unused variable `idy`. - Renamed `id` variable to `thread_id` for clarity. Signed-off-by: Jason Cameron --- TTS/engine_wrapper.py | 12 +++++------ requirements.txt | 16 ++++++-------- video_creation/background.py | 40 ++++++++++++++++++----------------- video_creation/final_video.py | 6 +++--- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index b3f9ac2..ec5c028 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -6,14 +6,13 @@ from typing import Tuple import numpy as np import translators from moviepy.audio.AudioClip import AudioClip -from moviepy.audio.fx.volumex import volumex -from moviepy.editor import AudioFileClip +from moviepy import AudioFileClip from rich.progress import track from utils import settings from utils.console import print_step, print_substep from utils.voice import sanitize_text - +from moviepy.audio.fx import MultiplyVolume DEFAULT_MAX_LENGTH: int = ( 50 # Video length variable, edit this on your own risk. It should work, but it's not supported ) @@ -112,7 +111,6 @@ class TTSEngine: ] self.create_silence_mp3() - idy = None for idy, text_cut in enumerate(split_text): newtext = process_text(text_cut) # print(f"{idx}-{idy}: {newtext}\n") @@ -171,12 +169,12 @@ class TTSEngine: def create_silence_mp3(self): silence_duration = settings.config["settings"]["tts"]["silence_duration"] silence = AudioClip( - make_frame=lambda t: np.sin(440 * 2 * np.pi * t), + frame_function=lambda t: np.sin(440 * 2 * np.pi * t), duration=silence_duration, fps=44100, ) - silence = volumex(silence, 0) - silence.write_audiofile(f"{self.path}/silence.mp3", fps=44100, verbose=False, logger=None) + silence = silence.with_effects([MultiplyVolume(0)]) + silence.write_audiofile(f"{self.path}/silence.mp3", fps=44100, logger=None) def process_text(text: str, clean: bool = True): diff --git a/requirements.txt b/requirements.txt index d034277..3e791f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,21 @@ -boto3==1.34.127 -botocore==1.34.127 +boto3==1.36.8 +botocore==1.36.8 gTTS==2.5.4 -moviepy==1.0.3 -playwright==1.48.0 +moviepy==2.1.2 +playwright==1.49.1 praw==7.8.1 requests==2.32.3 rich==13.9.4 toml==0.10.2 translators==5.9.5 pyttsx3==2.98 -Pillow==10.4.0 tomlkit==0.13.2 Flask==3.1.0 clean-text==0.6.0 unidecode==1.3.8 -spacy==3.8.3 -torch==2.4.1 +spacy==3.8.4 +torch==2.5.1 transformers==4.48.1 ffmpeg-python==0.2.0 -elevenlabs==1.8.1 +elevenlabs==1.50.5 yt-dlp==2025.1.26 -numpy==1.26.4 diff --git a/video_creation/background.py b/video_creation/background.py index 43be69a..ff4f318 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -6,7 +6,7 @@ from random import randrange from typing import Any, Dict, Tuple import yt_dlp -from moviepy.editor import AudioFileClip, VideoFileClip +from moviepy import AudioFileClip, VideoFileClip from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip from utils import settings @@ -14,26 +14,26 @@ from utils.console import print_step, print_substep def load_background_options(): - background_options = {} + _background_options = {} # Load background videos with open("./utils/background_videos.json") as json_file: - background_options["video"] = json.load(json_file) + _background_options["video"] = json.load(json_file) # Load background audios with open("./utils/background_audios.json") as json_file: - background_options["audio"] = json.load(json_file) + _background_options["audio"] = json.load(json_file) # Remove "__comment" from backgrounds - del background_options["video"]["__comment"] - del background_options["audio"]["__comment"] + del _background_options["video"]["__comment"] + del _background_options["audio"]["__comment"] - for name in list(background_options["video"].keys()): - pos = background_options["video"][name][3] + for name in list(_background_options["video"].keys()): + pos = _background_options["video"][name][3] if pos != "center": - background_options["video"][name][3] = lambda t: ("center", pos + t) + _background_options["video"][name][3] = lambda t: ("center", pos + t) - return background_options + return _background_options def get_start_and_end_times(video_length: int, length_of_clip: int) -> Tuple[int, int]: @@ -124,10 +124,11 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd """Generates the background audio and footage to be used in the video and writes it to assets/temp/background.mp3 and assets/temp/background.mp4 Args: + reddit_object (Dict[str,str]) : Reddit object background_config (Dict[str,Tuple]]) : Current background configuration video_length (int): Length of the clip where the background footage is to be taken out of """ - id = re.sub(r"[^\w\s-]", "", reddit_object["thread_id"]) + thread_id = re.sub(r"[^\w\s-]", "", reddit_object["thread_id"]) if settings.config["settings"]["background"][f"background_audio_volume"] == 0: print_step("Volume was set to 0. Skipping background audio creation . . .") @@ -138,8 +139,8 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd start_time_audio, end_time_audio = get_start_and_end_times( video_length, background_audio.duration ) - background_audio = background_audio.subclip(start_time_audio, end_time_audio) - background_audio.write_audiofile(f"assets/temp/{id}/background.mp3") + background_audio = background_audio.subclipped(start_time_audio, end_time_audio) + background_audio.write_audiofile(f"assets/temp/{thread_id}/background.mp3") print_step("Finding a spot in the backgrounds video to chop...✂️") video_choice = f"{background_config['video'][2]}-{background_config['video'][1]}" @@ -149,17 +150,18 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd ) # Extract video subclip try: + with VideoFileClip(f"assets/backgrounds/video/{video_choice}") as video: + new = video.subclipped(start_time_video, end_time_video) + new.write_videofile(f"assets/temp/{thread_id}/background.mp4") + + except (OSError, IOError): # ffmpeg issue see #348 + print_substep("FFMPEG issue. Trying again...") ffmpeg_extract_subclip( f"assets/backgrounds/video/{video_choice}", start_time_video, end_time_video, - targetname=f"assets/temp/{id}/background.mp4", + outputfile=f"assets/temp/{thread_id}/background.mp4", ) - except (OSError, IOError): # ffmpeg issue see #348 - print_substep("FFMPEG issue. Trying again...") - with VideoFileClip(f"assets/backgrounds/video/{video_choice}") as video: - new = video.subclip(start_time_video, end_time_video) - new.write_videofile(f"assets/temp/{id}/background.mp4") print_substep("Background video chopped successfully!", style="bold green") return background_config["video"][2] diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 85a0c1f..c8be6f5 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -93,7 +93,7 @@ def prepare_background(reddit_id: str, W: int, H: int) -> str: output_path, an=None, **{ - "c:v": "h264", + "c:v": "h264_nvenc", "b:v": "20M", "b:a": "192k", "threads": multiprocessing.cpu_count(), @@ -438,7 +438,7 @@ def make_final_video( path, f="mp4", **{ - "c:v": "h264", + "c:v": "h264_nvenc", "b:v": "20M", "b:a": "192k", "threads": multiprocessing.cpu_count(), @@ -468,7 +468,7 @@ def make_final_video( path, f="mp4", **{ - "c:v": "h264", + "c:v": "h264_nvenc", "b:v": "20M", "b:a": "192k", "threads": multiprocessing.cpu_count(), From 7ebea11608d6731f7e894ee2c8db733f9cc594ec Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 06:14:23 +0000 Subject: [PATCH 64/94] fixup: Format Python code with Black --- TTS/engine_wrapper.py | 5 +++-- video_creation/background.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index ec5c028..1026a6d 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -5,14 +5,15 @@ from typing import Tuple import numpy as np import translators -from moviepy.audio.AudioClip import AudioClip from moviepy import AudioFileClip +from moviepy.audio.AudioClip import AudioClip +from moviepy.audio.fx import MultiplyVolume from rich.progress import track from utils import settings from utils.console import print_step, print_substep from utils.voice import sanitize_text -from moviepy.audio.fx import MultiplyVolume + DEFAULT_MAX_LENGTH: int = ( 50 # Video length variable, edit this on your own risk. It should work, but it's not supported ) diff --git a/video_creation/background.py b/video_creation/background.py index ff4f318..aad552d 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -153,7 +153,7 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd with VideoFileClip(f"assets/backgrounds/video/{video_choice}") as video: new = video.subclipped(start_time_video, end_time_video) new.write_videofile(f"assets/temp/{thread_id}/background.mp4") - + except (OSError, IOError): # ffmpeg issue see #348 print_substep("FFMPEG issue. Trying again...") ffmpeg_extract_subclip( From ed20928974f863d95d2d15fb09b8d6eb4425480c Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Wed, 29 Jan 2025 01:14:39 -0500 Subject: [PATCH 65/94] chore: reformat Signed-off-by: Jason Cameron --- GUI.py | 4 +- TTS/TikTok.py | 4 +- TTS/aws_polly.py | 4 +- TTS/elevenlabs.py | 8 +++- TTS/engine_wrapper.py | 17 +++++-- TTS/pyttsx.py | 4 +- TTS/streamlabs_polly.py | 4 +- main.py | 4 +- reddit/subreddit.py | 25 +++++++--- utils/ai_methods.py | 20 ++++++-- utils/console.py | 17 +++++-- utils/ffmpeg_install.py | 8 ++-- utils/gui_utils.py | 22 +++++++-- utils/imagenarator.py | 8 +++- utils/playwright.py | 4 +- utils/settings.py | 32 ++++++++++--- utils/subreddit.py | 19 ++++++-- utils/thumbnail.py | 12 +++-- utils/videos.py | 8 +++- utils/voice.py | 4 +- video_creation/background.py | 14 ++++-- video_creation/final_video.py | 89 ++++++++++++++++++++++++++--------- video_creation/voices.py | 14 ++++-- 23 files changed, 262 insertions(+), 83 deletions(-) diff --git a/GUI.py b/GUI.py index 4588083..47dfc25 100644 --- a/GUI.py +++ b/GUI.py @@ -82,7 +82,9 @@ def settings(): # Change settings config = gui.modify_settings(data, config_load, checks) - return render_template("settings.html", file="config.toml", data=config, checks=checks) + return render_template( + "settings.html", file="config.toml", data=config, checks=checks + ) # Make videos.json accessible diff --git a/TTS/TikTok.py b/TTS/TikTok.py index 23d2918..f947732 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -86,7 +86,9 @@ class TikTok: "Cookie": f"sessionid={settings.config['settings']['tts']['tiktok_sessionid']}", } - self.URI_BASE = "https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke/" + self.URI_BASE = ( + "https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke/" + ) self.max_chars = 200 self._session = requests.Session() diff --git a/TTS/aws_polly.py b/TTS/aws_polly.py index 4d55860..58323f9 100644 --- a/TTS/aws_polly.py +++ b/TTS/aws_polly.py @@ -41,7 +41,9 @@ class AWSPolly: raise ValueError( f"Please set the TOML variable AWS_VOICE to a valid voice. options are: {voices}" ) - voice = str(settings.config["settings"]["tts"]["aws_polly_voice"]).capitalize() + voice = str( + settings.config["settings"]["tts"]["aws_polly_voice"] + ).capitalize() try: # Request speech synthesis response = polly.synthesize_speech( diff --git a/TTS/elevenlabs.py b/TTS/elevenlabs.py index c1f478e..68f1c16 100644 --- a/TTS/elevenlabs.py +++ b/TTS/elevenlabs.py @@ -17,9 +17,13 @@ class elevenlabs: if random_voice: voice = self.randomvoice() else: - voice = str(settings.config["settings"]["tts"]["elevenlabs_voice_name"]).capitalize() + voice = str( + settings.config["settings"]["tts"]["elevenlabs_voice_name"] + ).capitalize() - audio = self.client.generate(text=text, voice=voice, model="eleven_multilingual_v1") + audio = self.client.generate( + text=text, voice=voice, model="eleven_multilingual_v1" + ) save(audio=audio, filename=filepath) def initialize(self): diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index ec5c028..5a114a5 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -13,6 +13,7 @@ from utils import settings from utils.console import print_step, print_substep from utils.voice import sanitize_text from moviepy.audio.fx import MultiplyVolume + DEFAULT_MAX_LENGTH: int = ( 50 # Video length variable, edit this on your own risk. It should work, but it's not supported ) @@ -57,7 +58,9 @@ class TTSEngine: comment["comment_body"] = re.sub(regex_urls, " ", comment["comment_body"]) comment["comment_body"] = comment["comment_body"].replace("\n", ". ") comment["comment_body"] = re.sub(r"\bAI\b", "A.I", comment["comment_body"]) - comment["comment_body"] = re.sub(r"\bAGI\b", "A.G.I", comment["comment_body"]) + comment["comment_body"] = re.sub( + r"\bAGI\b", "A.G.I", comment["comment_body"] + ) if comment["comment_body"][-1] != ".": comment["comment_body"] += "." comment["comment_body"] = comment["comment_body"].replace(". . .", ".") @@ -79,13 +82,17 @@ class TTSEngine: if len(self.reddit_object["thread_post"]) > self.tts_module.max_chars: self.split_post(self.reddit_object["thread_post"], "postaudio") else: - self.call_tts("postaudio", process_text(self.reddit_object["thread_post"])) + self.call_tts( + "postaudio", process_text(self.reddit_object["thread_post"]) + ) elif settings.config["settings"]["storymodemethod"] == 1: for idx, text in track(enumerate(self.reddit_object["thread_post"])): self.call_tts(f"postaudio-{idx}", process_text(text)) else: - for idx, comment in track(enumerate(self.reddit_object["comments"]), "Saving..."): + for idx, comment in track( + enumerate(self.reddit_object["comments"]), "Saving..." + ): # ! Stop creating mp3 files if the length is greater than max length. if self.length > self.max_length and idx > 1: self.length -= self.last_clip_length @@ -182,6 +189,8 @@ def process_text(text: str, clean: bool = True): new_text = sanitize_text(text) if clean else text if lang: print_substep("Translating Text...") - translated_text = translators.translate_text(text, translator="google", to_language=lang) + translated_text = translators.translate_text( + text, translator="google", to_language=lang + ) new_text = sanitize_text(translated_text) return new_text diff --git a/TTS/pyttsx.py b/TTS/pyttsx.py index bf47601..a80bf2d 100644 --- a/TTS/pyttsx.py +++ b/TTS/pyttsx.py @@ -21,7 +21,9 @@ class pyttsx: if voice_id == "" or voice_num == "": voice_id = 2 voice_num = 3 - raise ValueError("set pyttsx values to a valid value, switching to defaults") + raise ValueError( + "set pyttsx values to a valid value, switching to defaults" + ) else: voice_id = int(voice_id) voice_num = int(voice_num) diff --git a/TTS/streamlabs_polly.py b/TTS/streamlabs_polly.py index 1541fac..f59626d 100644 --- a/TTS/streamlabs_polly.py +++ b/TTS/streamlabs_polly.py @@ -42,7 +42,9 @@ class StreamlabsPolly: raise ValueError( f"Please set the config variable STREAMLABS_POLLY_VOICE to a valid voice. options are: {voices}" ) - voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize() + voice = str( + settings.config["settings"]["tts"]["streamlabs_polly_voice"] + ).capitalize() body = {"voice": voice, "text": text, "service": "polly"} headers = {"Referer": "https://streamlabs.com/"} diff --git a/main.py b/main.py index 4e80a6e..9da85cd 100755 --- a/main.py +++ b/main.py @@ -106,7 +106,9 @@ if __name__ == "__main__": sys.exit() try: if config["reddit"]["thread"]["post_id"]: - for index, post_id in enumerate(config["reddit"]["thread"]["post_id"].split("+")): + for index, post_id in enumerate( + config["reddit"]["thread"]["post_id"].split("+") + ): index += 1 print_step( f'on the {index}{("st" if index % 10 == 1 else ("nd" if index % 10 == 2 else ("rd" if index % 10 == 3 else "th")))} post of {len(config["reddit"]["thread"]["post_id"].split("+"))}' diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5f2ac5f..fcf85f3 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -22,7 +22,9 @@ def get_subreddit_threads(POST_ID: str): content = {} if settings.config["reddit"]["creds"]["2fa"]: - print("\nEnter your two-factor authentication code from your authenticator app.\n") + print( + "\nEnter your two-factor authentication code from your authenticator app.\n" + ) code = input("> ") print() pw = settings.config["reddit"]["creds"]["password"] @@ -55,7 +57,9 @@ def get_subreddit_threads(POST_ID: str): ]: # note to user. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython") try: subreddit = reddit.subreddit( - re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) + re.sub( + r"r\/", "", input("What subreddit would you like to pull from? ") + ) # removes the r/ from the input ) except ValueError: @@ -65,7 +69,9 @@ def get_subreddit_threads(POST_ID: str): sub = settings.config["reddit"]["thread"]["subreddit"] print_substep(f"Using subreddit: r/{sub} from TOML config") subreddit_choice = sub - if str(subreddit_choice).casefold().startswith("r/"): # removes the r/ from the input + if ( + str(subreddit_choice).casefold().startswith("r/") + ): # removes the r/ from the input subreddit_choice = subreddit_choice[2:] subreddit = reddit.subreddit(subreddit_choice) @@ -76,8 +82,12 @@ def get_subreddit_threads(POST_ID: str): settings.config["reddit"]["thread"]["post_id"] and len(str(settings.config["reddit"]["thread"]["post_id"]).split("+")) == 1 ): - submission = reddit.submission(id=settings.config["reddit"]["thread"]["post_id"]) - elif settings.config["ai"]["ai_similarity_enabled"]: # ai sorting based on comparison + submission = reddit.submission( + id=settings.config["reddit"]["thread"]["post_id"] + ) + elif settings.config["ai"][ + "ai_similarity_enabled" + ]: # ai sorting based on comparison threads = subreddit.hot(limit=50) keywords = settings.config["ai"]["ai_similarity_keywords"].split(",") keywords = [keyword.strip() for keyword in keywords] @@ -95,7 +105,10 @@ def get_subreddit_threads(POST_ID: str): if submission is None: return get_subreddit_threads(POST_ID) # submission already done. rerun - elif not submission.num_comments and settings.config["settings"]["storymode"] == "false": + elif ( + not submission.num_comments + and settings.config["settings"]["storymode"] == "false" + ): print_substep("No comments found. Skipping.") exit() diff --git a/utils/ai_methods.py b/utils/ai_methods.py index 6926a71..e69677f 100644 --- a/utils/ai_methods.py +++ b/utils/ai_methods.py @@ -5,8 +5,12 @@ from transformers import AutoModel, AutoTokenizer # Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): - token_embeddings = model_output[0] # First element of model_output contains all token embeddings - input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() + token_embeddings = model_output[ + 0 + ] # First element of model_output contains all token embeddings + input_mask_expanded = ( + attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() + ) return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp( input_mask_expanded.sum(1), min=1e-9 ) @@ -32,13 +36,19 @@ def sort_by_similarity(thread_objects, keywords): ) with torch.no_grad(): threads_embeddings = model(**encoded_threads) - threads_embeddings = mean_pooling(threads_embeddings, encoded_threads["attention_mask"]) + threads_embeddings = mean_pooling( + threads_embeddings, encoded_threads["attention_mask"] + ) # Keyword inference - encoded_keywords = tokenizer(keywords, padding=True, truncation=True, return_tensors="pt") + encoded_keywords = tokenizer( + keywords, padding=True, truncation=True, return_tensors="pt" + ) with torch.no_grad(): keywords_embeddings = model(**encoded_keywords) - keywords_embeddings = mean_pooling(keywords_embeddings, encoded_keywords["attention_mask"]) + keywords_embeddings = mean_pooling( + keywords_embeddings, encoded_keywords["attention_mask"] + ) # Compare every keyword w/ every thread embedding threads_embeddings_tensor = torch.tensor(threads_embeddings) diff --git a/utils/console.py b/utils/console.py index a9abf4b..fe7f1c8 100644 --- a/utils/console.py +++ b/utils/console.py @@ -49,7 +49,10 @@ def handle_input( optional=False, ): if optional: - console.print(message + "\n[green]This is an optional value. Do you want to skip it? (y/n)") + console.print( + message + + "\n[green]This is an optional value. Do you want to skip it? (y/n)" + ) if input().casefold().startswith("y"): return default if default is not NotImplemented else "" if default is not NotImplemented: @@ -83,7 +86,11 @@ def handle_input( console.print("[red]" + err_message) continue elif match != "" and re.match(match, user_input) is None: - console.print("[red]" + err_message + "\nAre you absolutely sure it's correct?(y/n)") + console.print( + "[red]" + + err_message + + "\nAre you absolutely sure it's correct?(y/n)" + ) if input().casefold().startswith("y"): break continue @@ -116,5 +123,9 @@ def handle_input( if user_input in options: return user_input console.print( - "[red bold]" + err_message + "\nValid options are: " + ", ".join(map(str, options)) + "." + "[red bold]" + + err_message + + "\nValid options are: " + + ", ".join(map(str, options)) + + "." ) diff --git a/utils/ffmpeg_install.py b/utils/ffmpeg_install.py index b41bad6..c35fe01 100644 --- a/utils/ffmpeg_install.py +++ b/utils/ffmpeg_install.py @@ -7,9 +7,7 @@ import requests def ffmpeg_install_windows(): try: - ffmpeg_url = ( - "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build.zip" - ) + ffmpeg_url = "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build.zip" ffmpeg_zip_filename = "ffmpeg.zip" ffmpeg_extracted_folder = "ffmpeg" @@ -129,7 +127,9 @@ def ffmpeg_install(): elif os.name == "mac": ffmpeg_install_mac() else: - print("Your OS is not supported. Please install FFmpeg manually and try again.") + print( + "Your OS is not supported. Please install FFmpeg manually and try again." + ) exit() else: print("Please install FFmpeg manually and try again.") diff --git a/utils/gui_utils.py b/utils/gui_utils.py index 31c135f..5d4c80a 100644 --- a/utils/gui_utils.py +++ b/utils/gui_utils.py @@ -69,7 +69,11 @@ def check(value, checks): and not hasattr(value, "__iter__") and ( ("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"]) - or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"]) + or ( + "nmax" in checks + and checks["nmax"] is not None + and value > checks["nmax"] + ) ) ): incorrect = True @@ -78,8 +82,16 @@ def check(value, checks): not incorrect and hasattr(value, "__iter__") and ( - ("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"]) - or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"]) + ( + "nmin" in checks + and checks["nmin"] is not None + and len(value) < checks["nmin"] + ) + or ( + "nmax" in checks + and checks["nmax"] is not None + and len(value) > checks["nmax"] + ) ) ): incorrect = True @@ -152,7 +164,9 @@ def delete_background(key): # Add background video def add_background(youtube_uri, filename, citation, position): # Validate YouTube URI - regex = re.compile(r"(?:\/|%3D|v=|vi=)([0-9A-z\-_]{11})(?:[%#?&]|$)").search(youtube_uri) + regex = re.compile(r"(?:\/|%3D|v=|vi=)([0-9A-z\-_]{11})(?:[%#?&]|$)").search( + youtube_uri + ) if not regex: flash("YouTube URI is invalid!", "error") diff --git a/utils/imagenarator.py b/utils/imagenarator.py index ad75331..0c3c9d4 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -20,7 +20,9 @@ def draw_multiple_line_text( font_height = getheight(font, text) image_width, image_height = image.size lines = textwrap.wrap(text, width=wrap) - y = (image_height / 2) - (((font_height + (len(lines) * padding) / len(lines)) * len(lines)) / 2) + y = (image_height / 2) - ( + ((font_height + (len(lines) * padding) / len(lines)) * len(lines)) / 2 + ) for line in lines: line_width, line_height = getsize(font, line) if transparent: @@ -70,5 +72,7 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> for idx, text in track(enumerate(texts), "Rendering Image"): image = Image.new("RGBA", size, theme) text = process_text(text, False) - draw_multiple_line_text(image, text, font, txtclr, padding, wrap=30, transparent=transparent) + draw_multiple_line_text( + image, text, font, txtclr, padding, wrap=30, transparent=transparent + ) image.save(f"assets/temp/{reddit_id}/png/img{idx}.png") diff --git a/utils/playwright.py b/utils/playwright.py index 9672f03..be046e6 100644 --- a/utils/playwright.py +++ b/utils/playwright.py @@ -1,5 +1,7 @@ def clear_cookie_by_name(context, cookie_cleared_name): cookies = context.cookies() - filtered_cookies = [cookie for cookie in cookies if cookie["name"] != cookie_cleared_name] + filtered_cookies = [ + cookie for cookie in cookies if cookie["name"] != cookie_cleared_name + ] context.clear_cookies() context.add_cookies(filtered_cookies) diff --git a/utils/settings.py b/utils/settings.py index 6b8242b..62d0057 100755 --- a/utils/settings.py +++ b/utils/settings.py @@ -53,7 +53,11 @@ def check(value, checks, name): and not hasattr(value, "__iter__") and ( ("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"]) - or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"]) + or ( + "nmax" in checks + and checks["nmax"] is not None + and value > checks["nmax"] + ) ) ): incorrect = True @@ -61,8 +65,16 @@ def check(value, checks, name): not incorrect and hasattr(value, "__iter__") and ( - ("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"]) - or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"]) + ( + "nmin" in checks + and checks["nmin"] is not None + and len(value) < checks["nmin"] + ) + or ( + "nmax" in checks + and checks["nmax"] is not None + and len(value) > checks["nmax"] + ) ) ): incorrect = True @@ -70,9 +82,15 @@ def check(value, checks, name): if incorrect: value = handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + ( + ("[blue]Example: " + str(checks["example"]) + "\n") + if "example" in checks + else "" + ) + "[red]" - + ("Non-optional ", "Optional ")["optional" in checks and checks["optional"] is True] + + ("Non-optional ", "Optional ")[ + "optional" in checks and checks["optional"] is True + ] ) + "[#C0CAF5 bold]" + str(name) @@ -113,7 +131,9 @@ def check_toml(template_file, config_file) -> Tuple[bool, Dict]: try: template = toml.load(template_file) except Exception as error: - console.print(f"[red bold]Encountered error when trying to to load {template_file}: {error}") + console.print( + f"[red bold]Encountered error when trying to to load {template_file}: {error}" + ) return False try: config = toml.load(config_file) diff --git a/utils/subreddit.py b/utils/subreddit.py index 403b6d3..a3732f6 100644 --- a/utils/subreddit.py +++ b/utils/subreddit.py @@ -6,7 +6,9 @@ from utils.ai_methods import sort_by_similarity from utils.console import print_substep -def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similarity_scores=None): +def get_subreddit_undone( + submissions: list, subreddit, times_checked=0, similarity_scores=None +): """_summary_ Args: @@ -18,7 +20,9 @@ def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similari """ # Second try of getting a valid Submission if times_checked and settings.config["ai"]["ai_similarity_enabled"]: - print("Sorting based on similarity for a different date filter and thread limit..") + print( + "Sorting based on similarity for a different date filter and thread limit.." + ) submissions = sort_by_similarity( submissions, keywords=settings.config["ai"]["ai_similarity_enabled"] ) @@ -27,7 +31,9 @@ def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similari if not exists("./video_creation/data/videos.json"): with open("./video_creation/data/videos.json", "w+") as f: json.dump([], f) - with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw: + with open( + "./video_creation/data/videos.json", "r", encoding="utf-8" + ) as done_vids_raw: done_videos = json.load(done_vids_raw) for i, submission in enumerate(submissions): if already_done(done_videos, submission): @@ -43,7 +49,8 @@ def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similari print_substep("This post was pinned by moderators. Skipping...") continue if ( - submission.num_comments <= int(settings.config["reddit"]["thread"]["min_comments"]) + submission.num_comments + <= int(settings.config["reddit"]["thread"]["min_comments"]) and not settings.config["settings"]["storymode"] ): print_substep( @@ -52,7 +59,9 @@ def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similari 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") + 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 diff --git a/utils/thumbnail.py b/utils/thumbnail.py index 172b454..aeb82b4 100644 --- a/utils/thumbnail.py +++ b/utils/thumbnail.py @@ -1,11 +1,15 @@ from PIL import ImageDraw, ImageFont -def create_thumbnail(thumbnail, font_family, font_size, font_color, width, height, title): +def create_thumbnail( + thumbnail, font_family, font_size, font_color, width, height, title +): font = ImageFont.truetype(font_family + ".ttf", font_size) Xaxis = width - (width * 0.2) # 20% of the width sizeLetterXaxis = font_size * 0.5 # 50% of the font size - XaxisLetterQty = round(Xaxis / sizeLetterXaxis) # Quantity of letters that can fit in the X axis + XaxisLetterQty = round( + Xaxis / sizeLetterXaxis + ) # Quantity of letters that can fit in the X axis MarginYaxis = height * 0.12 # 12% of the height MarginXaxis = width * 0.05 # 5% of the width # 1.1 rem @@ -30,6 +34,8 @@ def create_thumbnail(thumbnail, font_family, font_size, font_color, width, heigh # loop for put the title in the thumbnail for i in range(0, len(arrayTitle)): # 1.1 rem - draw.text((MarginXaxis, MarginYaxis + (LineHeight * i)), arrayTitle[i], rgb, font=font) + draw.text( + (MarginXaxis, MarginYaxis + (LineHeight * i)), arrayTitle[i], rgb, font=font + ) return thumbnail diff --git a/utils/videos.py b/utils/videos.py index 7c756fc..c30cb2c 100755 --- a/utils/videos.py +++ b/utils/videos.py @@ -19,7 +19,9 @@ def check_done( Returns: Submission|None: Reddit object in args """ - with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw: + with open( + "./video_creation/data/videos.json", "r", encoding="utf-8" + ) as done_vids_raw: done_videos = json.load(done_vids_raw) for video in done_videos: if video["id"] == str(redditobj): @@ -33,7 +35,9 @@ def check_done( return redditobj -def save_data(subreddit: str, filename: str, reddit_title: str, reddit_id: str, credit: str): +def save_data( + subreddit: str, filename: str, reddit_title: str, reddit_id: str, credit: str +): """Saves the videos that have already been generated to a JSON file in video_creation/data/videos.json Args: diff --git a/utils/voice.py b/utils/voice.py index 56595fc..9bc09d8 100644 --- a/utils/voice.py +++ b/utils/voice.py @@ -43,7 +43,9 @@ def sleep_until(time) -> None: if sys.version_info[0] >= 3 and time.tzinfo: end = time.astimezone(timezone.utc).timestamp() else: - zoneDiff = pytime.time() - (datetime.now() - datetime(1970, 1, 1)).total_seconds() + zoneDiff = ( + pytime.time() - (datetime.now() - datetime(1970, 1, 1)).total_seconds() + ) end = (time - datetime(1970, 1, 1)).total_seconds() + zoneDiff # Type check diff --git a/video_creation/background.py b/video_creation/background.py index ff4f318..54a5c49 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -60,7 +60,9 @@ def get_start_and_end_times(video_length: int, length_of_clip: int) -> Tuple[int def get_background_config(mode: str): """Fetch the background/s configuration""" try: - choice = str(settings.config["settings"]["background"][f"background_{mode}"]).casefold() + choice = str( + settings.config["settings"]["background"][f"background_{mode}"] + ).casefold() except AttributeError: print_substep("No background selected. Picking random background'") choice = None @@ -120,7 +122,9 @@ def download_background_audio(background_config: Tuple[str, str, str]): print_substep("Background audio downloaded successfully! 🎉", style="bold green") -def chop_background(background_config: Dict[str, Tuple], video_length: int, reddit_object: dict): +def chop_background( + background_config: Dict[str, Tuple], video_length: int, reddit_object: dict +): """Generates the background audio and footage to be used in the video and writes it to assets/temp/background.mp3 and assets/temp/background.mp4 Args: @@ -134,7 +138,9 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd print_step("Volume was set to 0. Skipping background audio creation . . .") else: print_step("Finding a spot in the backgrounds audio to chop...✂️") - audio_choice = f"{background_config['audio'][2]}-{background_config['audio'][1]}" + audio_choice = ( + f"{background_config['audio'][2]}-{background_config['audio'][1]}" + ) background_audio = AudioFileClip(f"assets/backgrounds/audio/{audio_choice}") start_time_audio, end_time_audio = get_start_and_end_times( video_length, background_audio.duration @@ -153,7 +159,7 @@ def chop_background(background_config: Dict[str, Tuple], video_length: int, redd with VideoFileClip(f"assets/backgrounds/video/{video_choice}") as video: new = video.subclipped(start_time_video, end_time_video) new.write_videofile(f"assets/temp/{thread_id}/background.mp4") - + except (OSError, IOError): # ffmpeg issue see #348 print_substep("FFMPEG issue. Trying again...") ffmpeg_extract_subclip( diff --git a/video_creation/final_video.py b/video_creation/final_video.py index c8be6f5..72a8efa 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -78,7 +78,9 @@ def name_normalize(name: str) -> str: lang = settings.config["reddit"]["thread"]["post_lang"] if lang: print_substep("Translating filename...") - translated_name = translators.translate_text(name, translator="google", to_language=lang) + translated_name = translators.translate_text( + name, translator="google", to_language=lang + ) return translated_name else: return name @@ -141,8 +143,12 @@ def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): bottom_part_height = image_height - top_part_height - middle_part_height top_part = image.crop((0, 0, image_width, top_part_height)) - middle_part = image.crop((0, top_part_height, image_width, top_part_height + middle_part_height)) - bottom_part = image.crop((0, top_part_height + middle_part_height, image_width, image_height)) + middle_part = image.crop( + (0, top_part_height, image_width, top_part_height + middle_part_height) + ) + bottom_part = image.crop( + (0, top_part_height + middle_part_height, image_width, image_height) + ) # Stretch the middle part new_middle_height = new_image_height - top_part_height - bottom_part_height @@ -182,7 +188,9 @@ def merge_background_audio(audio: ffmpeg, reddit_id: str): audio (ffmpeg): The TTS final audio but without background. reddit_id (str): The ID of subreddit """ - background_audio_volume = settings.config["settings"]["background"]["background_audio_volume"] + background_audio_volume = settings.config["settings"]["background"][ + "background_audio_volume" + ] if background_audio_volume == 0: return audio # Return the original audio else: @@ -236,27 +244,42 @@ def make_final_video( if settings.config["settings"]["storymode"]: if settings.config["settings"]["storymodemethod"] == 0: audio_clips = [ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")] - audio_clips.insert(1, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio.mp3")) + audio_clips.insert( + 1, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio.mp3") + ) elif settings.config["settings"]["storymodemethod"] == 1: audio_clips = [ ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3") - for i in track(range(number_of_clips + 1), "Collecting the audio files...") + for i in track( + range(number_of_clips + 1), "Collecting the audio files..." + ) ] - audio_clips.insert(0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")) + audio_clips.insert( + 0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3") + ) else: audio_clips = [ - ffmpeg.input(f"assets/temp/{reddit_id}/mp3/{i}.mp3") for i in range(number_of_clips) + ffmpeg.input(f"assets/temp/{reddit_id}/mp3/{i}.mp3") + for i in range(number_of_clips) ] audio_clips.insert(0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")) audio_clips_durations = [ - float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/{i}.mp3")["format"]["duration"]) + float( + ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/{i}.mp3")["format"][ + "duration" + ] + ) for i in range(number_of_clips) ] audio_clips_durations.insert( 0, - float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"]["duration"]), + float( + ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"][ + "duration" + ] + ), ) audio_concat = ffmpeg.concat(*audio_clips, a=1, v=0) ffmpeg.output( @@ -299,13 +322,19 @@ def make_final_video( if settings.config["settings"]["storymode"]: audio_clips_durations = [ float( - ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")["format"]["duration"] + ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")[ + "format" + ]["duration"] ) for i in range(number_of_clips) ] audio_clips_durations.insert( 0, - float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"]["duration"]), + float( + ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"][ + "duration" + ] + ), ) if settings.config["settings"]["storymodemethod"] == 0: image_clips.insert( @@ -322,7 +351,9 @@ def make_final_video( ) current_time += audio_clips_durations[0] elif settings.config["settings"]["storymodemethod"] == 1: - for i in track(range(0, number_of_clips + 1), "Collecting the image files..."): + for i in track( + range(0, number_of_clips + 1), "Collecting the image files..." + ): image_clips.append( ffmpeg.input(f"assets/temp/{reddit_id}/png/img{i}.png")["v"].filter( "scale", screenshot_width, -1 @@ -338,9 +369,9 @@ def make_final_video( else: for i in range(0, number_of_clips + 1): image_clips.append( - ffmpeg.input(f"assets/temp/{reddit_id}/png/comment_{i}.png")["v"].filter( - "scale", screenshot_width, -1 - ) + ffmpeg.input(f"assets/temp/{reddit_id}/png/comment_{i}.png")[ + "v" + ].filter("scale", screenshot_width, -1) ) image_overlay = image_clips[i].filter("colorchannelmixer", aa=opacity) assert ( @@ -362,11 +393,15 @@ def make_final_video( subreddit = settings.config["reddit"]["thread"]["subreddit"] if not exists(f"./results/{subreddit}"): - print_substep("The 'results' folder could not be found so it was automatically created.") + print_substep( + "The 'results' folder could not be found so it was automatically created." + ) os.makedirs(f"./results/{subreddit}") if not exists(f"./results/{subreddit}/OnlyTTS") and allowOnlyTTSFolder: - print_substep("The 'OnlyTTS' folder could not be found so it was automatically created.") + print_substep( + "The 'OnlyTTS' folder could not be found so it was automatically created." + ) os.makedirs(f"./results/{subreddit}/OnlyTTS") # create a thumbnail for the video @@ -380,7 +415,11 @@ def make_final_video( os.makedirs(f"./results/{subreddit}/thumbnails") # get the first file with the .png extension from assets/backgrounds and use it as a background for the thumbnail first_image = next( - (file for file in os.listdir("assets/backgrounds") if file.endswith(".png")), + ( + file + for file in os.listdir("assets/backgrounds") + if file.endswith(".png") + ), None, ) if first_image is None: @@ -402,7 +441,9 @@ def make_final_video( title_thumb, ) thumbnailSave.save(f"./assets/temp/{reddit_id}/thumbnail.png") - print_substep(f"Thumbnail - Building Thumbnail in assets/temp/{reddit_id}/thumbnail.png") + print_substep( + f"Thumbnail - Building Thumbnail in assets/temp/{reddit_id}/thumbnail.png" + ) text = f"Background by {background_config['video'][2]}" background_clip = ffmpeg.drawtext( @@ -443,7 +484,9 @@ def make_final_video( "b:a": "192k", "threads": multiprocessing.cpu_count(), }, - ).overwrite_output().global_args("-progress", progress.output_file.name).run( + ).overwrite_output().global_args( + "-progress", progress.output_file.name + ).run( quiet=True, overwrite_output=True, capture_stdout=False, @@ -473,7 +516,9 @@ def make_final_video( "b:a": "192k", "threads": multiprocessing.cpu_count(), }, - ).overwrite_output().global_args("-progress", progress.output_file.name).run( + ).overwrite_output().global_args( + "-progress", progress.output_file.name + ).run( quiet=True, overwrite_output=True, capture_stdout=False, diff --git a/video_creation/voices.py b/video_creation/voices.py index ad94a14..fa29c01 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -36,7 +36,9 @@ def save_text_to_mp3(reddit_obj) -> Tuple[int, int]: voice = settings.config["settings"]["tts"]["voice_choice"] if str(voice).casefold() in map(lambda _: _.casefold(), TTSProviders): - text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, voice), reddit_obj) + text_to_mp3 = TTSEngine( + get_case_insensitive_key_value(TTSProviders, voice), reddit_obj + ) else: while True: print_step("Please choose one of the following TTS providers: ") @@ -45,12 +47,18 @@ def save_text_to_mp3(reddit_obj) -> Tuple[int, int]: if choice.casefold() in map(lambda _: _.casefold(), TTSProviders): break print("Unknown Choice") - text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, choice), reddit_obj) + text_to_mp3 = TTSEngine( + get_case_insensitive_key_value(TTSProviders, choice), reddit_obj + ) return text_to_mp3.run() def get_case_insensitive_key_value(input_dict, key): return next( - (value for dict_key, value in input_dict.items() if dict_key.lower() == key.lower()), + ( + value + for dict_key, value in input_dict.items() + if dict_key.lower() == key.lower() + ), None, ) From ccfb66546396adcbd3e0a3af4018e91695af1515 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 06:15:54 +0000 Subject: [PATCH 66/94] fixup: Format Python code with Black --- GUI.py | 4 +- TTS/TikTok.py | 4 +- TTS/aws_polly.py | 4 +- TTS/elevenlabs.py | 8 +--- TTS/pyttsx.py | 4 +- TTS/streamlabs_polly.py | 4 +- main.py | 4 +- reddit/subreddit.py | 25 +++------- utils/ai_methods.py | 20 ++------ utils/console.py | 17 ++----- utils/ffmpeg_install.py | 8 ++-- utils/gui_utils.py | 22 ++------- utils/imagenarator.py | 8 +--- utils/playwright.py | 4 +- utils/settings.py | 32 +++---------- utils/subreddit.py | 19 ++------ utils/thumbnail.py | 12 ++--- utils/videos.py | 8 +--- utils/voice.py | 4 +- video_creation/background.py | 12 ++--- video_creation/final_video.py | 89 +++++++++-------------------------- video_creation/voices.py | 14 ++---- 22 files changed, 78 insertions(+), 248 deletions(-) diff --git a/GUI.py b/GUI.py index 47dfc25..4588083 100644 --- a/GUI.py +++ b/GUI.py @@ -82,9 +82,7 @@ def settings(): # Change settings config = gui.modify_settings(data, config_load, checks) - return render_template( - "settings.html", file="config.toml", data=config, checks=checks - ) + return render_template("settings.html", file="config.toml", data=config, checks=checks) # Make videos.json accessible diff --git a/TTS/TikTok.py b/TTS/TikTok.py index f947732..23d2918 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -86,9 +86,7 @@ class TikTok: "Cookie": f"sessionid={settings.config['settings']['tts']['tiktok_sessionid']}", } - self.URI_BASE = ( - "https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke/" - ) + self.URI_BASE = "https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke/" self.max_chars = 200 self._session = requests.Session() diff --git a/TTS/aws_polly.py b/TTS/aws_polly.py index 58323f9..4d55860 100644 --- a/TTS/aws_polly.py +++ b/TTS/aws_polly.py @@ -41,9 +41,7 @@ class AWSPolly: raise ValueError( f"Please set the TOML variable AWS_VOICE to a valid voice. options are: {voices}" ) - voice = str( - settings.config["settings"]["tts"]["aws_polly_voice"] - ).capitalize() + voice = str(settings.config["settings"]["tts"]["aws_polly_voice"]).capitalize() try: # Request speech synthesis response = polly.synthesize_speech( diff --git a/TTS/elevenlabs.py b/TTS/elevenlabs.py index 68f1c16..c1f478e 100644 --- a/TTS/elevenlabs.py +++ b/TTS/elevenlabs.py @@ -17,13 +17,9 @@ class elevenlabs: if random_voice: voice = self.randomvoice() else: - voice = str( - settings.config["settings"]["tts"]["elevenlabs_voice_name"] - ).capitalize() + voice = str(settings.config["settings"]["tts"]["elevenlabs_voice_name"]).capitalize() - audio = self.client.generate( - text=text, voice=voice, model="eleven_multilingual_v1" - ) + audio = self.client.generate(text=text, voice=voice, model="eleven_multilingual_v1") save(audio=audio, filename=filepath) def initialize(self): diff --git a/TTS/pyttsx.py b/TTS/pyttsx.py index a80bf2d..bf47601 100644 --- a/TTS/pyttsx.py +++ b/TTS/pyttsx.py @@ -21,9 +21,7 @@ class pyttsx: if voice_id == "" or voice_num == "": voice_id = 2 voice_num = 3 - raise ValueError( - "set pyttsx values to a valid value, switching to defaults" - ) + raise ValueError("set pyttsx values to a valid value, switching to defaults") else: voice_id = int(voice_id) voice_num = int(voice_num) diff --git a/TTS/streamlabs_polly.py b/TTS/streamlabs_polly.py index f59626d..1541fac 100644 --- a/TTS/streamlabs_polly.py +++ b/TTS/streamlabs_polly.py @@ -42,9 +42,7 @@ class StreamlabsPolly: raise ValueError( f"Please set the config variable STREAMLABS_POLLY_VOICE to a valid voice. options are: {voices}" ) - voice = str( - settings.config["settings"]["tts"]["streamlabs_polly_voice"] - ).capitalize() + voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize() body = {"voice": voice, "text": text, "service": "polly"} headers = {"Referer": "https://streamlabs.com/"} diff --git a/main.py b/main.py index 9da85cd..4e80a6e 100755 --- a/main.py +++ b/main.py @@ -106,9 +106,7 @@ if __name__ == "__main__": sys.exit() try: if config["reddit"]["thread"]["post_id"]: - for index, post_id in enumerate( - config["reddit"]["thread"]["post_id"].split("+") - ): + for index, post_id in enumerate(config["reddit"]["thread"]["post_id"].split("+")): index += 1 print_step( f'on the {index}{("st" if index % 10 == 1 else ("nd" if index % 10 == 2 else ("rd" if index % 10 == 3 else "th")))} post of {len(config["reddit"]["thread"]["post_id"].split("+"))}' diff --git a/reddit/subreddit.py b/reddit/subreddit.py index fcf85f3..5f2ac5f 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -22,9 +22,7 @@ def get_subreddit_threads(POST_ID: str): content = {} if settings.config["reddit"]["creds"]["2fa"]: - print( - "\nEnter your two-factor authentication code from your authenticator app.\n" - ) + print("\nEnter your two-factor authentication code from your authenticator app.\n") code = input("> ") print() pw = settings.config["reddit"]["creds"]["password"] @@ -57,9 +55,7 @@ def get_subreddit_threads(POST_ID: str): ]: # note to user. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython") try: subreddit = reddit.subreddit( - re.sub( - r"r\/", "", input("What subreddit would you like to pull from? ") - ) + re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) # removes the r/ from the input ) except ValueError: @@ -69,9 +65,7 @@ def get_subreddit_threads(POST_ID: str): sub = settings.config["reddit"]["thread"]["subreddit"] print_substep(f"Using subreddit: r/{sub} from TOML config") subreddit_choice = sub - if ( - str(subreddit_choice).casefold().startswith("r/") - ): # removes the r/ from the input + if str(subreddit_choice).casefold().startswith("r/"): # removes the r/ from the input subreddit_choice = subreddit_choice[2:] subreddit = reddit.subreddit(subreddit_choice) @@ -82,12 +76,8 @@ def get_subreddit_threads(POST_ID: str): settings.config["reddit"]["thread"]["post_id"] and len(str(settings.config["reddit"]["thread"]["post_id"]).split("+")) == 1 ): - submission = reddit.submission( - id=settings.config["reddit"]["thread"]["post_id"] - ) - elif settings.config["ai"][ - "ai_similarity_enabled" - ]: # ai sorting based on comparison + submission = reddit.submission(id=settings.config["reddit"]["thread"]["post_id"]) + elif settings.config["ai"]["ai_similarity_enabled"]: # ai sorting based on comparison threads = subreddit.hot(limit=50) keywords = settings.config["ai"]["ai_similarity_keywords"].split(",") keywords = [keyword.strip() for keyword in keywords] @@ -105,10 +95,7 @@ def get_subreddit_threads(POST_ID: str): if submission is None: return get_subreddit_threads(POST_ID) # submission already done. rerun - elif ( - not submission.num_comments - and settings.config["settings"]["storymode"] == "false" - ): + elif not submission.num_comments and settings.config["settings"]["storymode"] == "false": print_substep("No comments found. Skipping.") exit() diff --git a/utils/ai_methods.py b/utils/ai_methods.py index e69677f..6926a71 100644 --- a/utils/ai_methods.py +++ b/utils/ai_methods.py @@ -5,12 +5,8 @@ from transformers import AutoModel, AutoTokenizer # Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): - token_embeddings = model_output[ - 0 - ] # First element of model_output contains all token embeddings - input_mask_expanded = ( - attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() - ) + token_embeddings = model_output[0] # First element of model_output contains all token embeddings + input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp( input_mask_expanded.sum(1), min=1e-9 ) @@ -36,19 +32,13 @@ def sort_by_similarity(thread_objects, keywords): ) with torch.no_grad(): threads_embeddings = model(**encoded_threads) - threads_embeddings = mean_pooling( - threads_embeddings, encoded_threads["attention_mask"] - ) + threads_embeddings = mean_pooling(threads_embeddings, encoded_threads["attention_mask"]) # Keyword inference - encoded_keywords = tokenizer( - keywords, padding=True, truncation=True, return_tensors="pt" - ) + encoded_keywords = tokenizer(keywords, padding=True, truncation=True, return_tensors="pt") with torch.no_grad(): keywords_embeddings = model(**encoded_keywords) - keywords_embeddings = mean_pooling( - keywords_embeddings, encoded_keywords["attention_mask"] - ) + keywords_embeddings = mean_pooling(keywords_embeddings, encoded_keywords["attention_mask"]) # Compare every keyword w/ every thread embedding threads_embeddings_tensor = torch.tensor(threads_embeddings) diff --git a/utils/console.py b/utils/console.py index fe7f1c8..a9abf4b 100644 --- a/utils/console.py +++ b/utils/console.py @@ -49,10 +49,7 @@ def handle_input( optional=False, ): if optional: - console.print( - message - + "\n[green]This is an optional value. Do you want to skip it? (y/n)" - ) + console.print(message + "\n[green]This is an optional value. Do you want to skip it? (y/n)") if input().casefold().startswith("y"): return default if default is not NotImplemented else "" if default is not NotImplemented: @@ -86,11 +83,7 @@ def handle_input( console.print("[red]" + err_message) continue elif match != "" and re.match(match, user_input) is None: - console.print( - "[red]" - + err_message - + "\nAre you absolutely sure it's correct?(y/n)" - ) + console.print("[red]" + err_message + "\nAre you absolutely sure it's correct?(y/n)") if input().casefold().startswith("y"): break continue @@ -123,9 +116,5 @@ def handle_input( if user_input in options: return user_input console.print( - "[red bold]" - + err_message - + "\nValid options are: " - + ", ".join(map(str, options)) - + "." + "[red bold]" + err_message + "\nValid options are: " + ", ".join(map(str, options)) + "." ) diff --git a/utils/ffmpeg_install.py b/utils/ffmpeg_install.py index c35fe01..b41bad6 100644 --- a/utils/ffmpeg_install.py +++ b/utils/ffmpeg_install.py @@ -7,7 +7,9 @@ import requests def ffmpeg_install_windows(): try: - ffmpeg_url = "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build.zip" + ffmpeg_url = ( + "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build.zip" + ) ffmpeg_zip_filename = "ffmpeg.zip" ffmpeg_extracted_folder = "ffmpeg" @@ -127,9 +129,7 @@ def ffmpeg_install(): elif os.name == "mac": ffmpeg_install_mac() else: - print( - "Your OS is not supported. Please install FFmpeg manually and try again." - ) + print("Your OS is not supported. Please install FFmpeg manually and try again.") exit() else: print("Please install FFmpeg manually and try again.") diff --git a/utils/gui_utils.py b/utils/gui_utils.py index 5d4c80a..31c135f 100644 --- a/utils/gui_utils.py +++ b/utils/gui_utils.py @@ -69,11 +69,7 @@ def check(value, checks): and not hasattr(value, "__iter__") and ( ("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"]) - or ( - "nmax" in checks - and checks["nmax"] is not None - and value > checks["nmax"] - ) + or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"]) ) ): incorrect = True @@ -82,16 +78,8 @@ def check(value, checks): not incorrect and hasattr(value, "__iter__") and ( - ( - "nmin" in checks - and checks["nmin"] is not None - and len(value) < checks["nmin"] - ) - or ( - "nmax" in checks - and checks["nmax"] is not None - and len(value) > checks["nmax"] - ) + ("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"]) + or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"]) ) ): incorrect = True @@ -164,9 +152,7 @@ def delete_background(key): # Add background video def add_background(youtube_uri, filename, citation, position): # Validate YouTube URI - regex = re.compile(r"(?:\/|%3D|v=|vi=)([0-9A-z\-_]{11})(?:[%#?&]|$)").search( - youtube_uri - ) + regex = re.compile(r"(?:\/|%3D|v=|vi=)([0-9A-z\-_]{11})(?:[%#?&]|$)").search(youtube_uri) if not regex: flash("YouTube URI is invalid!", "error") diff --git a/utils/imagenarator.py b/utils/imagenarator.py index 0c3c9d4..ad75331 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -20,9 +20,7 @@ def draw_multiple_line_text( font_height = getheight(font, text) image_width, image_height = image.size lines = textwrap.wrap(text, width=wrap) - y = (image_height / 2) - ( - ((font_height + (len(lines) * padding) / len(lines)) * len(lines)) / 2 - ) + y = (image_height / 2) - (((font_height + (len(lines) * padding) / len(lines)) * len(lines)) / 2) for line in lines: line_width, line_height = getsize(font, line) if transparent: @@ -72,7 +70,5 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> for idx, text in track(enumerate(texts), "Rendering Image"): image = Image.new("RGBA", size, theme) text = process_text(text, False) - draw_multiple_line_text( - image, text, font, txtclr, padding, wrap=30, transparent=transparent - ) + draw_multiple_line_text(image, text, font, txtclr, padding, wrap=30, transparent=transparent) image.save(f"assets/temp/{reddit_id}/png/img{idx}.png") diff --git a/utils/playwright.py b/utils/playwright.py index be046e6..9672f03 100644 --- a/utils/playwright.py +++ b/utils/playwright.py @@ -1,7 +1,5 @@ def clear_cookie_by_name(context, cookie_cleared_name): cookies = context.cookies() - filtered_cookies = [ - cookie for cookie in cookies if cookie["name"] != cookie_cleared_name - ] + filtered_cookies = [cookie for cookie in cookies if cookie["name"] != cookie_cleared_name] context.clear_cookies() context.add_cookies(filtered_cookies) diff --git a/utils/settings.py b/utils/settings.py index 62d0057..6b8242b 100755 --- a/utils/settings.py +++ b/utils/settings.py @@ -53,11 +53,7 @@ def check(value, checks, name): and not hasattr(value, "__iter__") and ( ("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"]) - or ( - "nmax" in checks - and checks["nmax"] is not None - and value > checks["nmax"] - ) + or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"]) ) ): incorrect = True @@ -65,16 +61,8 @@ def check(value, checks, name): not incorrect and hasattr(value, "__iter__") and ( - ( - "nmin" in checks - and checks["nmin"] is not None - and len(value) < checks["nmin"] - ) - or ( - "nmax" in checks - and checks["nmax"] is not None - and len(value) > checks["nmax"] - ) + ("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"]) + or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"]) ) ): incorrect = True @@ -82,15 +70,9 @@ def check(value, checks, name): if incorrect: value = handle_input( message=( - ( - ("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks - else "" - ) + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" - + ("Non-optional ", "Optional ")[ - "optional" in checks and checks["optional"] is True - ] + + ("Non-optional ", "Optional ")["optional" in checks and checks["optional"] is True] ) + "[#C0CAF5 bold]" + str(name) @@ -131,9 +113,7 @@ def check_toml(template_file, config_file) -> Tuple[bool, Dict]: try: template = toml.load(template_file) except Exception as error: - console.print( - f"[red bold]Encountered error when trying to to load {template_file}: {error}" - ) + console.print(f"[red bold]Encountered error when trying to to load {template_file}: {error}") return False try: config = toml.load(config_file) diff --git a/utils/subreddit.py b/utils/subreddit.py index a3732f6..403b6d3 100644 --- a/utils/subreddit.py +++ b/utils/subreddit.py @@ -6,9 +6,7 @@ from utils.ai_methods import sort_by_similarity from utils.console import print_substep -def get_subreddit_undone( - submissions: list, subreddit, times_checked=0, similarity_scores=None -): +def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similarity_scores=None): """_summary_ Args: @@ -20,9 +18,7 @@ def get_subreddit_undone( """ # Second try of getting a valid Submission if times_checked and settings.config["ai"]["ai_similarity_enabled"]: - print( - "Sorting based on similarity for a different date filter and thread limit.." - ) + print("Sorting based on similarity for a different date filter and thread limit..") submissions = sort_by_similarity( submissions, keywords=settings.config["ai"]["ai_similarity_enabled"] ) @@ -31,9 +27,7 @@ def get_subreddit_undone( if not exists("./video_creation/data/videos.json"): with open("./video_creation/data/videos.json", "w+") as f: json.dump([], f) - with open( - "./video_creation/data/videos.json", "r", encoding="utf-8" - ) as done_vids_raw: + with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw: done_videos = json.load(done_vids_raw) for i, submission in enumerate(submissions): if already_done(done_videos, submission): @@ -49,8 +43,7 @@ def get_subreddit_undone( print_substep("This post was pinned by moderators. Skipping...") continue if ( - submission.num_comments - <= int(settings.config["reddit"]["thread"]["min_comments"]) + submission.num_comments <= int(settings.config["reddit"]["thread"]["min_comments"]) and not settings.config["settings"]["storymode"] ): print_substep( @@ -59,9 +52,7 @@ def get_subreddit_undone( 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" - ) + 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 diff --git a/utils/thumbnail.py b/utils/thumbnail.py index aeb82b4..172b454 100644 --- a/utils/thumbnail.py +++ b/utils/thumbnail.py @@ -1,15 +1,11 @@ from PIL import ImageDraw, ImageFont -def create_thumbnail( - thumbnail, font_family, font_size, font_color, width, height, title -): +def create_thumbnail(thumbnail, font_family, font_size, font_color, width, height, title): font = ImageFont.truetype(font_family + ".ttf", font_size) Xaxis = width - (width * 0.2) # 20% of the width sizeLetterXaxis = font_size * 0.5 # 50% of the font size - XaxisLetterQty = round( - Xaxis / sizeLetterXaxis - ) # Quantity of letters that can fit in the X axis + XaxisLetterQty = round(Xaxis / sizeLetterXaxis) # Quantity of letters that can fit in the X axis MarginYaxis = height * 0.12 # 12% of the height MarginXaxis = width * 0.05 # 5% of the width # 1.1 rem @@ -34,8 +30,6 @@ def create_thumbnail( # loop for put the title in the thumbnail for i in range(0, len(arrayTitle)): # 1.1 rem - draw.text( - (MarginXaxis, MarginYaxis + (LineHeight * i)), arrayTitle[i], rgb, font=font - ) + draw.text((MarginXaxis, MarginYaxis + (LineHeight * i)), arrayTitle[i], rgb, font=font) return thumbnail diff --git a/utils/videos.py b/utils/videos.py index c30cb2c..7c756fc 100755 --- a/utils/videos.py +++ b/utils/videos.py @@ -19,9 +19,7 @@ def check_done( Returns: Submission|None: Reddit object in args """ - with open( - "./video_creation/data/videos.json", "r", encoding="utf-8" - ) as done_vids_raw: + with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw: done_videos = json.load(done_vids_raw) for video in done_videos: if video["id"] == str(redditobj): @@ -35,9 +33,7 @@ def check_done( return redditobj -def save_data( - subreddit: str, filename: str, reddit_title: str, reddit_id: str, credit: str -): +def save_data(subreddit: str, filename: str, reddit_title: str, reddit_id: str, credit: str): """Saves the videos that have already been generated to a JSON file in video_creation/data/videos.json Args: diff --git a/utils/voice.py b/utils/voice.py index 9bc09d8..56595fc 100644 --- a/utils/voice.py +++ b/utils/voice.py @@ -43,9 +43,7 @@ def sleep_until(time) -> None: if sys.version_info[0] >= 3 and time.tzinfo: end = time.astimezone(timezone.utc).timestamp() else: - zoneDiff = ( - pytime.time() - (datetime.now() - datetime(1970, 1, 1)).total_seconds() - ) + zoneDiff = pytime.time() - (datetime.now() - datetime(1970, 1, 1)).total_seconds() end = (time - datetime(1970, 1, 1)).total_seconds() + zoneDiff # Type check diff --git a/video_creation/background.py b/video_creation/background.py index 54a5c49..aad552d 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -60,9 +60,7 @@ def get_start_and_end_times(video_length: int, length_of_clip: int) -> Tuple[int def get_background_config(mode: str): """Fetch the background/s configuration""" try: - choice = str( - settings.config["settings"]["background"][f"background_{mode}"] - ).casefold() + choice = str(settings.config["settings"]["background"][f"background_{mode}"]).casefold() except AttributeError: print_substep("No background selected. Picking random background'") choice = None @@ -122,9 +120,7 @@ def download_background_audio(background_config: Tuple[str, str, str]): print_substep("Background audio downloaded successfully! 🎉", style="bold green") -def chop_background( - background_config: Dict[str, Tuple], video_length: int, reddit_object: dict -): +def chop_background(background_config: Dict[str, Tuple], video_length: int, reddit_object: dict): """Generates the background audio and footage to be used in the video and writes it to assets/temp/background.mp3 and assets/temp/background.mp4 Args: @@ -138,9 +134,7 @@ def chop_background( print_step("Volume was set to 0. Skipping background audio creation . . .") else: print_step("Finding a spot in the backgrounds audio to chop...✂️") - audio_choice = ( - f"{background_config['audio'][2]}-{background_config['audio'][1]}" - ) + audio_choice = f"{background_config['audio'][2]}-{background_config['audio'][1]}" background_audio = AudioFileClip(f"assets/backgrounds/audio/{audio_choice}") start_time_audio, end_time_audio = get_start_and_end_times( video_length, background_audio.duration diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 72a8efa..c8be6f5 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -78,9 +78,7 @@ def name_normalize(name: str) -> str: lang = settings.config["reddit"]["thread"]["post_lang"] if lang: print_substep("Translating filename...") - translated_name = translators.translate_text( - name, translator="google", to_language=lang - ) + translated_name = translators.translate_text(name, translator="google", to_language=lang) return translated_name else: return name @@ -143,12 +141,8 @@ def create_fancy_thumbnail(image, text, text_color, padding, wrap=35): bottom_part_height = image_height - top_part_height - middle_part_height top_part = image.crop((0, 0, image_width, top_part_height)) - middle_part = image.crop( - (0, top_part_height, image_width, top_part_height + middle_part_height) - ) - bottom_part = image.crop( - (0, top_part_height + middle_part_height, image_width, image_height) - ) + middle_part = image.crop((0, top_part_height, image_width, top_part_height + middle_part_height)) + bottom_part = image.crop((0, top_part_height + middle_part_height, image_width, image_height)) # Stretch the middle part new_middle_height = new_image_height - top_part_height - bottom_part_height @@ -188,9 +182,7 @@ def merge_background_audio(audio: ffmpeg, reddit_id: str): audio (ffmpeg): The TTS final audio but without background. reddit_id (str): The ID of subreddit """ - background_audio_volume = settings.config["settings"]["background"][ - "background_audio_volume" - ] + background_audio_volume = settings.config["settings"]["background"]["background_audio_volume"] if background_audio_volume == 0: return audio # Return the original audio else: @@ -244,42 +236,27 @@ def make_final_video( if settings.config["settings"]["storymode"]: if settings.config["settings"]["storymodemethod"] == 0: audio_clips = [ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")] - audio_clips.insert( - 1, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio.mp3") - ) + audio_clips.insert(1, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio.mp3")) elif settings.config["settings"]["storymodemethod"] == 1: audio_clips = [ ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3") - for i in track( - range(number_of_clips + 1), "Collecting the audio files..." - ) + for i in track(range(number_of_clips + 1), "Collecting the audio files...") ] - audio_clips.insert( - 0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3") - ) + audio_clips.insert(0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")) else: audio_clips = [ - ffmpeg.input(f"assets/temp/{reddit_id}/mp3/{i}.mp3") - for i in range(number_of_clips) + ffmpeg.input(f"assets/temp/{reddit_id}/mp3/{i}.mp3") for i in range(number_of_clips) ] audio_clips.insert(0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")) audio_clips_durations = [ - float( - ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/{i}.mp3")["format"][ - "duration" - ] - ) + float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/{i}.mp3")["format"]["duration"]) for i in range(number_of_clips) ] audio_clips_durations.insert( 0, - float( - ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"][ - "duration" - ] - ), + float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"]["duration"]), ) audio_concat = ffmpeg.concat(*audio_clips, a=1, v=0) ffmpeg.output( @@ -322,19 +299,13 @@ def make_final_video( if settings.config["settings"]["storymode"]: audio_clips_durations = [ float( - ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")[ - "format" - ]["duration"] + ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")["format"]["duration"] ) for i in range(number_of_clips) ] audio_clips_durations.insert( 0, - float( - ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"][ - "duration" - ] - ), + float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"]["duration"]), ) if settings.config["settings"]["storymodemethod"] == 0: image_clips.insert( @@ -351,9 +322,7 @@ def make_final_video( ) current_time += audio_clips_durations[0] elif settings.config["settings"]["storymodemethod"] == 1: - for i in track( - range(0, number_of_clips + 1), "Collecting the image files..." - ): + for i in track(range(0, number_of_clips + 1), "Collecting the image files..."): image_clips.append( ffmpeg.input(f"assets/temp/{reddit_id}/png/img{i}.png")["v"].filter( "scale", screenshot_width, -1 @@ -369,9 +338,9 @@ def make_final_video( else: for i in range(0, number_of_clips + 1): image_clips.append( - ffmpeg.input(f"assets/temp/{reddit_id}/png/comment_{i}.png")[ - "v" - ].filter("scale", screenshot_width, -1) + ffmpeg.input(f"assets/temp/{reddit_id}/png/comment_{i}.png")["v"].filter( + "scale", screenshot_width, -1 + ) ) image_overlay = image_clips[i].filter("colorchannelmixer", aa=opacity) assert ( @@ -393,15 +362,11 @@ def make_final_video( subreddit = settings.config["reddit"]["thread"]["subreddit"] if not exists(f"./results/{subreddit}"): - print_substep( - "The 'results' folder could not be found so it was automatically created." - ) + print_substep("The 'results' folder could not be found so it was automatically created.") os.makedirs(f"./results/{subreddit}") if not exists(f"./results/{subreddit}/OnlyTTS") and allowOnlyTTSFolder: - print_substep( - "The 'OnlyTTS' folder could not be found so it was automatically created." - ) + print_substep("The 'OnlyTTS' folder could not be found so it was automatically created.") os.makedirs(f"./results/{subreddit}/OnlyTTS") # create a thumbnail for the video @@ -415,11 +380,7 @@ def make_final_video( os.makedirs(f"./results/{subreddit}/thumbnails") # get the first file with the .png extension from assets/backgrounds and use it as a background for the thumbnail first_image = next( - ( - file - for file in os.listdir("assets/backgrounds") - if file.endswith(".png") - ), + (file for file in os.listdir("assets/backgrounds") if file.endswith(".png")), None, ) if first_image is None: @@ -441,9 +402,7 @@ def make_final_video( title_thumb, ) thumbnailSave.save(f"./assets/temp/{reddit_id}/thumbnail.png") - print_substep( - f"Thumbnail - Building Thumbnail in assets/temp/{reddit_id}/thumbnail.png" - ) + print_substep(f"Thumbnail - Building Thumbnail in assets/temp/{reddit_id}/thumbnail.png") text = f"Background by {background_config['video'][2]}" background_clip = ffmpeg.drawtext( @@ -484,9 +443,7 @@ def make_final_video( "b:a": "192k", "threads": multiprocessing.cpu_count(), }, - ).overwrite_output().global_args( - "-progress", progress.output_file.name - ).run( + ).overwrite_output().global_args("-progress", progress.output_file.name).run( quiet=True, overwrite_output=True, capture_stdout=False, @@ -516,9 +473,7 @@ def make_final_video( "b:a": "192k", "threads": multiprocessing.cpu_count(), }, - ).overwrite_output().global_args( - "-progress", progress.output_file.name - ).run( + ).overwrite_output().global_args("-progress", progress.output_file.name).run( quiet=True, overwrite_output=True, capture_stdout=False, diff --git a/video_creation/voices.py b/video_creation/voices.py index fa29c01..ad94a14 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -36,9 +36,7 @@ def save_text_to_mp3(reddit_obj) -> Tuple[int, int]: voice = settings.config["settings"]["tts"]["voice_choice"] if str(voice).casefold() in map(lambda _: _.casefold(), TTSProviders): - text_to_mp3 = TTSEngine( - get_case_insensitive_key_value(TTSProviders, voice), reddit_obj - ) + text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, voice), reddit_obj) else: while True: print_step("Please choose one of the following TTS providers: ") @@ -47,18 +45,12 @@ def save_text_to_mp3(reddit_obj) -> Tuple[int, int]: if choice.casefold() in map(lambda _: _.casefold(), TTSProviders): break print("Unknown Choice") - text_to_mp3 = TTSEngine( - get_case_insensitive_key_value(TTSProviders, choice), reddit_obj - ) + text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, choice), reddit_obj) return text_to_mp3.run() def get_case_insensitive_key_value(input_dict, key): return next( - ( - value - for dict_key, value in input_dict.items() - if dict_key.lower() == key.lower() - ), + (value for dict_key, value in input_dict.items() if dict_key.lower() == key.lower()), None, ) From 4017f65d6a3fdeb7396e12f9a7f1e0924e8cf063 Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Wed, 29 Jan 2025 01:31:24 -0500 Subject: [PATCH 67/94] fix: Improve login error handling (develop) The login error handling was improved to exit when an error is encountered, even if the error message is empty. The user agent string is now dynamically generated using the browser version. Signed-off-by: Jason Cameron --- video_creation/screenshot_downloader.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 2e0b4be..8dafaf6 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -85,7 +85,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): color_scheme="dark", viewport=ViewportSize(width=W, height=H), device_scale_factor=dsf, - user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", + user_agent=f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{browser.version}.0.0.0 Safari/537.36", extra_http_headers={ "Dnt": "1", "Sec-Ch-Ua": '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"', @@ -110,17 +110,12 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): login_error_div = page.locator(".AnimatedForm__errorMessage").first if login_error_div.is_visible(): - login_error_message = login_error_div.inner_text() - if login_error_message.strip() == "": - # The div element is empty, no error - pass - else: - # The div contains an error message - print_substep( - "Your reddit credentials are incorrect! Please modify them accordingly in the config.toml file.", - style="red", - ) - exit() + + print_substep( + "Your reddit credentials are incorrect! Please modify them accordingly in the config.toml file.", + style="red", + ) + exit() else: pass From 0d601e44d243a8e156e459f7792258eee88d4955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:48:49 +0000 Subject: [PATCH 68/94] Bump torch from 2.5.1 to 2.6.0 Bumps [torch](https://github.com/pytorch/pytorch) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.5.1...v2.6.0) --- updated-dependencies: - dependency-name: torch dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3e791f0..f32f773 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ Flask==3.1.0 clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.4 -torch==2.5.1 +torch==2.6.0 transformers==4.48.1 ffmpeg-python==0.2.0 elevenlabs==1.50.5 From b6ce1d4042a1edf0a0f5b2dd7923c01b9b216690 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 10:42:49 +0000 Subject: [PATCH 69/94] Bump transformers from 4.48.1 to 4.48.2 Bumps [transformers](https://github.com/huggingface/transformers) from 4.48.1 to 4.48.2. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.48.1...v4.48.2) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f32f773..12ee9df 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.4 torch==2.6.0 -transformers==4.48.1 +transformers==4.48.2 ffmpeg-python==0.2.0 elevenlabs==1.50.5 yt-dlp==2025.1.26 From e1ba6c4a8d28d8e9497450f261e9bbb9a222878e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:58:15 +0000 Subject: [PATCH 70/94] Bump elevenlabs from 1.50.5 to 1.50.7 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.50.5 to 1.50.7. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/1.50.5...1.50.7) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f32f773..a689a3e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.48.1 ffmpeg-python==0.2.0 -elevenlabs==1.50.5 +elevenlabs==1.50.7 yt-dlp==2025.1.26 From 51195762a09babd66eb584aa9309e17002c9c391 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 10:15:32 +0000 Subject: [PATCH 71/94] Bump yt-dlp from 2025.1.26 to 2025.2.19 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2025.1.26 to 2025.2.19. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2025.01.26...2025.02.19) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7682640..ec9ad95 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ torch==2.6.0 transformers==4.48.2 ffmpeg-python==0.2.0 elevenlabs==1.50.7 -yt-dlp==2025.1.26 +yt-dlp==2025.2.19 From dd53d28d378ed0e3fa49bc827bf169ad5c0001b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 23:12:29 +0000 Subject: [PATCH 72/94] Bump elevenlabs from 1.50.7 to 1.51.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.50.7 to 1.51.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/1.50.7...1.51.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ec9ad95..bcf58fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.48.2 ffmpeg-python==0.2.0 -elevenlabs==1.50.7 +elevenlabs==1.51.0 yt-dlp==2025.2.19 From 0bbaaeb88a26b835f06966d84c016c3f918362ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 23:12:33 +0000 Subject: [PATCH 73/94] Bump transformers from 4.48.2 to 4.49.0 Bumps [transformers](https://github.com/huggingface/transformers) from 4.48.2 to 4.49.0. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.48.2...v4.49.0) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ec9ad95..d650d6e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.4 torch==2.6.0 -transformers==4.48.2 +transformers==4.49.0 ffmpeg-python==0.2.0 elevenlabs==1.50.7 yt-dlp==2025.2.19 From a06e5225947306058779f339d9df320249b61d97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 10:45:40 +0000 Subject: [PATCH 74/94] Bump elevenlabs from 1.51.0 to 1.52.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.51.0 to 1.52.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/1.51.0...v1.52.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b6c6299..8b2d78d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.49.0 ffmpeg-python==0.2.0 -elevenlabs==1.51.0 +elevenlabs==1.52.0 yt-dlp==2025.2.19 From afc612567ff20292a970a57345c4f7f6b0ac2b9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:24:38 +0000 Subject: [PATCH 75/94] Bump translators from 5.9.5 to 5.9.9 Bumps [translators](https://github.com/UlionTse/translators) from 5.9.5 to 5.9.9. - [Changelog](https://github.com/UlionTse/translators/blob/master/README_history.md) - [Commits](https://github.com/UlionTse/translators/commits) --- updated-dependencies: - dependency-name: translators dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b6c6299..ff76181 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ praw==7.8.1 requests==2.32.3 rich==13.9.4 toml==0.10.2 -translators==5.9.5 +translators==5.9.9 pyttsx3==2.98 tomlkit==0.13.2 Flask==3.1.0 From b3cafbe22188ca266f15c3b2e2b4288337510243 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:29:52 +0000 Subject: [PATCH 76/94] Bump elevenlabs from 1.52.0 to 1.54.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.52.0 to 1.54.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.52.0...v1.54.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4805469..e669ee6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.49.0 ffmpeg-python==0.2.0 -elevenlabs==1.52.0 +elevenlabs==1.54.0 yt-dlp==2025.2.19 From e137dbb40d7b6ed90ddf2e6a7b857a241508aa25 Mon Sep 17 00:00:00 2001 From: bnfone <89687390+bnfone@users.noreply.github.com> Date: Sun, 16 Mar 2025 16:29:35 +0100 Subject: [PATCH 77/94] adding OpenAI TTS API Option This allows users to configure OpenAI TTS API to generate voice for their videos, which might be a cheaper option than ElevenLabs (especially if one runs KokoroTTS localy [which has a similar API structure like OpenAI and is fully compatible]) --- TTS/openai_tts.py | 89 +++++++++++++++++++++++++++++++++++++ main.py | 1 + utils/.config.template.toml | 5 ++- video_creation/voices.py | 2 + 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 TTS/openai_tts.py diff --git a/TTS/openai_tts.py b/TTS/openai_tts.py new file mode 100644 index 0000000..f439e2d --- /dev/null +++ b/TTS/openai_tts.py @@ -0,0 +1,89 @@ +import random +import requests +from utils import settings + +class OpenAITTS: + """ + A Text-to-Speech engine that uses an OpenAI-like TTS API endpoint to generate audio from text. + + Attributes: + max_chars (int): Maximum number of characters allowed per API call. + api_key (str): API key loaded from settings. + api_url (str): The complete API endpoint URL, built from a base URL provided in the config. + available_voices (list): Static list of supported voices (according to current docs). + """ + def __init__(self): + # Set maximum input size based on API limits (4096 characters per request) + self.max_chars = 4096 + self.api_key = settings.config["settings"]["tts"].get("openai_api_key") + if not self.api_key: + raise ValueError("No OpenAI API key provided in settings! Please set 'openai_api_key' in your config.") + + # Lese den Basis-URL aus der Konfiguration (z. B. "https://api.openai.com/v1" oder "https://api.openai.com/v1/") + base_url = settings.config["settings"]["tts"].get("openai_api_url", "https://api.openai.com/v1") + # Entferne ggf. den abschließenden Slash + if base_url.endswith("/"): + base_url = base_url[:-1] + # Hänge den TTS-spezifischen Pfad an + self.api_url = base_url + "/audio/speech" + + # Set the available voices to a static list as per OpenAI TTS documentation. + self.available_voices = self.get_available_voices() + + def get_available_voices(self): + """ + Return a static list of supported voices for the OpenAI TTS API. + + According to the documentation, supported voices include: + "alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer" + """ + return ["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] + + def randomvoice(self): + """ + Select and return a random voice from the available voices. + """ + return random.choice(self.available_voices) + + def run(self, text, filepath, random_voice: bool = False): + """ + Convert the provided text to speech and save the resulting audio to the specified filepath. + + Args: + text (str): The input text to convert. + filepath (str): The file path where the generated audio will be saved. + random_voice (bool): If True, select a random voice from the available voices. + """ + # Choose voice based on configuration or randomly if requested. + if random_voice: + voice = self.randomvoice() + else: + voice = settings.config["settings"]["tts"].get("openai_voice_name", "alloy") + voice = str(voice).lower() # Ensure lower-case as expected by the API + + # Select the model from configuration; default to 'tts-1' + model = settings.config["settings"]["tts"].get("openai_model", "tts-1") + + # Debug output: print which voice and model will be used + print(f"Using OpenAI TTS model: {model} with voice: {voice}") + + # Erstelle das Payload für den API-Request + payload = { + "model": model, + "voice": voice, + "input": text, + "response_format": "mp3" # erlaubte Formate: "mp3", "aac", "opus", "flac", "pcm" oder "wav" + } + headers = { + "Authorization": f"Bearer {self.api_key}", + "Content-Type": "application/json" + } + try: + response = requests.post(self.api_url, headers=headers, json=payload) + if response.status_code != 200: + raise RuntimeError(f"Error from TTS API: {response.status_code} {response.text}") + # Schreibe die Binärdaten (mp3) direkt in die Datei. + with open(filepath, "wb") as f: + f.write(response.content) + except Exception as e: + raise RuntimeError(f"Failed to generate audio with OpenAI TTS API: {str(e)}") \ No newline at end of file diff --git a/main.py b/main.py index 849663d..744ca67 100755 --- a/main.py +++ b/main.py @@ -122,6 +122,7 @@ if __name__ == "__main__": except Exception as err: config["settings"]["tts"]["tiktok_sessionid"] = "REDACTED" config["settings"]["tts"]["elevenlabs_api_key"] = "REDACTED" + config["settings"]["tts"]["openai_api_key"] = "REDACTED" print_step( f"Sorry, something went wrong with this version! Try again, and feel free to report this issue at GitHub or the Discord community.\n" f"Version: {__VERSION__} \n" diff --git a/utils/.config.template.toml b/utils/.config.template.toml index f4a3af0..3c98b15 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -44,7 +44,6 @@ background_thumbnail_font_size = { optional = true, type = "int", default = 96, background_thumbnail_font_color = { optional = true, default = "255,255,255", example = "255,255,255", explanation = "Font color in RGB format for the thumbnail text" } [settings.tts] -voice_choice = { optional = false, default = "tiktok", options = ["elevenlabs", "streamlabspolly", "tiktok", "googletranslate", "awspolly", "pyttsx", ], example = "tiktok", explanation = "The voice platform used for TTS generation. " } random_voice = { optional = false, type = "bool", default = true, example = true, options = [true, false,], explanation = "Randomizes the voice used for each comment" } elevenlabs_voice_name = { optional = false, default = "Bella", example = "Bella", explanation = "The voice used for elevenlabs", options = ["Adam", "Antoni", "Arnold", "Bella", "Domi", "Elli", "Josh", "Rachel", "Sam", ] } elevenlabs_api_key = { optional = true, example = "21f13f91f54d741e2ae27d2ab1b99d59", explanation = "Elevenlabs API key" } @@ -56,3 +55,7 @@ python_voice = { optional = false, default = "1", example = "1", explanation = " py_voice_num = { optional = false, default = "2", example = "2", explanation = "The number of system voices (2 are pre-installed in Windows)" } silence_duration = { optional = true, example = "0.1", explanation = "Time in seconds between TTS comments", default = 0.3, type = "float" } no_emojis = { optional = false, type = "bool", default = false, example = false, options = [true, false,], explanation = "Whether to remove emojis from the comments" } +openai_api_url = { optional = true, default = "https://api.openai.com/v1/", example = "https://api.openai.com/v1/", explanation = "The API endpoint URL for OpenAI TTS generation" } +openai_api_key = { optional = true, example = "sk-abc123def456...", explanation = "Your OpenAI API key for TTS generation" } +openai_voice_name = { optional = false, default = "alloy", example = "alloy", explanation = "The voice used for OpenAI TTS generation", options = ["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] } +openai_model = { optional = false, default = "tts-1", example = "tts-1", explanation = "The model variant used for OpenAI TTS generation", options = ["tts-1", "tts-1-hd"] } \ No newline at end of file diff --git a/video_creation/voices.py b/video_creation/voices.py index ad94a14..13ded7c 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -9,6 +9,7 @@ from TTS.GTTS import GTTS from TTS.pyttsx import pyttsx from TTS.streamlabs_polly import StreamlabsPolly from TTS.TikTok import TikTok +from TTS.openai_tts import OpenAITTS from utils import settings from utils.console import print_step, print_table @@ -21,6 +22,7 @@ TTSProviders = { "TikTok": TikTok, "pyttsx": pyttsx, "ElevenLabs": elevenlabs, + "OpenAI": OpenAITTS, } From 3e4eb17ef899c6be98ca43230c6dd367a558855a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 11:39:00 +0000 Subject: [PATCH 78/94] Bump yt-dlp from 2025.2.19 to 2025.3.21 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2025.2.19 to 2025.3.21. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2025.02.19...2025.03.21) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e669ee6..543b438 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ torch==2.6.0 transformers==4.49.0 ffmpeg-python==0.2.0 elevenlabs==1.54.0 -yt-dlp==2025.2.19 +yt-dlp==2025.3.21 From 0aa18eaf548820e1b476658a5a6855882fb0a9ed Mon Sep 17 00:00:00 2001 From: bnfone <89687390+bnfone@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:44:43 +0100 Subject: [PATCH 79/94] feature: OpenAI TTS API - requested changes feature: OpenAI TTS API - formatting & requested changes (see https://github.com/elebumm/RedditVideoMakerBot/pull/2268) --- TTS/openai_tts.py | 9 +++------ utils/.config.template.toml | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/TTS/openai_tts.py b/TTS/openai_tts.py index f439e2d..774a7a6 100644 --- a/TTS/openai_tts.py +++ b/TTS/openai_tts.py @@ -64,15 +64,12 @@ class OpenAITTS: # Select the model from configuration; default to 'tts-1' model = settings.config["settings"]["tts"].get("openai_model", "tts-1") - # Debug output: print which voice and model will be used - print(f"Using OpenAI TTS model: {model} with voice: {voice}") - - # Erstelle das Payload für den API-Request + # Create Payload for API-request payload = { "model": model, "voice": voice, "input": text, - "response_format": "mp3" # erlaubte Formate: "mp3", "aac", "opus", "flac", "pcm" oder "wav" + "response_format": "mp3" # allowed formats: "mp3", "aac", "opus", "flac", "pcm" or "wav" } headers = { "Authorization": f"Bearer {self.api_key}", @@ -82,7 +79,7 @@ class OpenAITTS: response = requests.post(self.api_url, headers=headers, json=payload) if response.status_code != 200: raise RuntimeError(f"Error from TTS API: {response.status_code} {response.text}") - # Schreibe die Binärdaten (mp3) direkt in die Datei. + # Write response as binary into file. with open(filepath, "wb") as f: f.write(response.content) except Exception as e: diff --git a/utils/.config.template.toml b/utils/.config.template.toml index 3c98b15..4732782 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -57,5 +57,5 @@ silence_duration = { optional = true, example = "0.1", explanation = "Time in se no_emojis = { optional = false, type = "bool", default = false, example = false, options = [true, false,], explanation = "Whether to remove emojis from the comments" } openai_api_url = { optional = true, default = "https://api.openai.com/v1/", example = "https://api.openai.com/v1/", explanation = "The API endpoint URL for OpenAI TTS generation" } openai_api_key = { optional = true, example = "sk-abc123def456...", explanation = "Your OpenAI API key for TTS generation" } -openai_voice_name = { optional = false, default = "alloy", example = "alloy", explanation = "The voice used for OpenAI TTS generation", options = ["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] } -openai_model = { optional = false, default = "tts-1", example = "tts-1", explanation = "The model variant used for OpenAI TTS generation", options = ["tts-1", "tts-1-hd"] } \ No newline at end of file +openai_voice_name = { optional = false, default = "alloy", example = "alloy", explanation = "The voice used for OpenAI TTS generation", options = ["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "af_heart"] } +openai_model = { optional = false, default = "tts-1", example = "tts-1", explanation = "The model variant used for OpenAI TTS generation", options = ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"] } \ No newline at end of file From 2ed5aa6f2153d77a5433f4488252bfa82a178280 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:52:59 +0000 Subject: [PATCH 80/94] fixup: Format Python code with Black --- TTS/openai_tts.py | 31 ++++++++++++++++++------------- video_creation/voices.py | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/TTS/openai_tts.py b/TTS/openai_tts.py index 774a7a6..a267163 100644 --- a/TTS/openai_tts.py +++ b/TTS/openai_tts.py @@ -1,39 +1,47 @@ import random + import requests + from utils import settings + class OpenAITTS: """ A Text-to-Speech engine that uses an OpenAI-like TTS API endpoint to generate audio from text. - + Attributes: max_chars (int): Maximum number of characters allowed per API call. api_key (str): API key loaded from settings. api_url (str): The complete API endpoint URL, built from a base URL provided in the config. available_voices (list): Static list of supported voices (according to current docs). """ + def __init__(self): # Set maximum input size based on API limits (4096 characters per request) self.max_chars = 4096 self.api_key = settings.config["settings"]["tts"].get("openai_api_key") if not self.api_key: - raise ValueError("No OpenAI API key provided in settings! Please set 'openai_api_key' in your config.") - + raise ValueError( + "No OpenAI API key provided in settings! Please set 'openai_api_key' in your config." + ) + # Lese den Basis-URL aus der Konfiguration (z. B. "https://api.openai.com/v1" oder "https://api.openai.com/v1/") - base_url = settings.config["settings"]["tts"].get("openai_api_url", "https://api.openai.com/v1") + base_url = settings.config["settings"]["tts"].get( + "openai_api_url", "https://api.openai.com/v1" + ) # Entferne ggf. den abschließenden Slash if base_url.endswith("/"): base_url = base_url[:-1] # Hänge den TTS-spezifischen Pfad an self.api_url = base_url + "/audio/speech" - + # Set the available voices to a static list as per OpenAI TTS documentation. self.available_voices = self.get_available_voices() def get_available_voices(self): """ Return a static list of supported voices for the OpenAI TTS API. - + According to the documentation, supported voices include: "alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer" """ @@ -48,7 +56,7 @@ class OpenAITTS: def run(self, text, filepath, random_voice: bool = False): """ Convert the provided text to speech and save the resulting audio to the specified filepath. - + Args: text (str): The input text to convert. filepath (str): The file path where the generated audio will be saved. @@ -69,12 +77,9 @@ class OpenAITTS: "model": model, "voice": voice, "input": text, - "response_format": "mp3" # allowed formats: "mp3", "aac", "opus", "flac", "pcm" or "wav" - } - headers = { - "Authorization": f"Bearer {self.api_key}", - "Content-Type": "application/json" + "response_format": "mp3", # allowed formats: "mp3", "aac", "opus", "flac", "pcm" or "wav" } + headers = {"Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json"} try: response = requests.post(self.api_url, headers=headers, json=payload) if response.status_code != 200: @@ -83,4 +88,4 @@ class OpenAITTS: with open(filepath, "wb") as f: f.write(response.content) except Exception as e: - raise RuntimeError(f"Failed to generate audio with OpenAI TTS API: {str(e)}") \ No newline at end of file + raise RuntimeError(f"Failed to generate audio with OpenAI TTS API: {str(e)}") diff --git a/video_creation/voices.py b/video_creation/voices.py index 13ded7c..3d48e9e 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -6,10 +6,10 @@ from TTS.aws_polly import AWSPolly from TTS.elevenlabs import elevenlabs from TTS.engine_wrapper import TTSEngine from TTS.GTTS import GTTS +from TTS.openai_tts import OpenAITTS from TTS.pyttsx import pyttsx from TTS.streamlabs_polly import StreamlabsPolly from TTS.TikTok import TikTok -from TTS.openai_tts import OpenAITTS from utils import settings from utils.console import print_step, print_table From cdd2171d1cef81583bbb1ce7ed65baaa8f88b27c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:25:20 +0000 Subject: [PATCH 81/94] Bump transformers from 4.49.0 to 4.50.2 Bumps [transformers](https://github.com/huggingface/transformers) from 4.49.0 to 4.50.2. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.49.0...v4.50.2) --- updated-dependencies: - dependency-name: transformers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 543b438..f1313c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.4 torch==2.6.0 -transformers==4.49.0 +transformers==4.50.2 ffmpeg-python==0.2.0 elevenlabs==1.54.0 yt-dlp==2025.3.21 From 5e60813e03e1840aed4e0652c0e54aaf03771767 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 10:27:28 +0000 Subject: [PATCH 82/94] Bump elevenlabs from 1.54.0 to 1.55.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.54.0 to 1.55.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.54.0...v1.55.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 543b438..df724ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.49.0 ffmpeg-python==0.2.0 -elevenlabs==1.54.0 +elevenlabs==1.55.0 yt-dlp==2025.3.21 From 41754ad6c0f92845c4f12ccd4f0310d0205b85ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 30 Mar 2025 21:31:45 +0000 Subject: [PATCH 83/94] Bump yt-dlp from 2025.3.21 to 2025.3.27 Bumps [yt-dlp](https://github.com/yt-dlp/yt-dlp) from 2025.3.21 to 2025.3.27. - [Release notes](https://github.com/yt-dlp/yt-dlp/releases) - [Changelog](https://github.com/yt-dlp/yt-dlp/blob/master/Changelog.md) - [Commits](https://github.com/yt-dlp/yt-dlp/compare/2025.03.21...2025.03.27) --- updated-dependencies: - dependency-name: yt-dlp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 76f63cf..09a282c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ torch==2.6.0 transformers==4.50.2 ffmpeg-python==0.2.0 elevenlabs==1.55.0 -yt-dlp==2025.3.21 +yt-dlp==2025.3.27 From c3781d4f2fbfc65b7e6c008df17c2f1f38fdfd2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 11:45:03 +0000 Subject: [PATCH 84/94] Bump elevenlabs from 1.55.0 to 1.57.0 Bumps [elevenlabs](https://github.com/elevenlabs/elevenlabs-python) from 1.55.0 to 1.57.0. - [Release notes](https://github.com/elevenlabs/elevenlabs-python/releases) - [Commits](https://github.com/elevenlabs/elevenlabs-python/compare/v1.55.0...v1.57.0) --- updated-dependencies: - dependency-name: elevenlabs dependency-version: 1.57.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 09a282c..786e5b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ spacy==3.8.4 torch==2.6.0 transformers==4.50.2 ffmpeg-python==0.2.0 -elevenlabs==1.55.0 +elevenlabs==1.57.0 yt-dlp==2025.3.27 From efce2e8c73c2557e1c9da168632336f324e7d635 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:53:06 +0000 Subject: [PATCH 85/94] Bump unidecode from 1.3.8 to 1.4.0 Bumps [unidecode](https://github.com/kmike/text-unidecode) from 1.3.8 to 1.4.0. - [Release notes](https://github.com/kmike/text-unidecode/releases) - [Commits](https://github.com/kmike/text-unidecode/commits) --- updated-dependencies: - dependency-name: unidecode dependency-version: 1.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 09a282c..c8384cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pyttsx3==2.98 tomlkit==0.13.2 Flask==3.1.0 clean-text==0.6.0 -unidecode==1.3.8 +unidecode==1.4.0 spacy==3.8.4 torch==2.6.0 transformers==4.50.2 From 6d7ef10df084ca10c7e595ae405905546643c5fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:53:12 +0000 Subject: [PATCH 86/94] Bump torch from 2.6.0 to 2.7.0 Bumps [torch](https://github.com/pytorch/pytorch) from 2.6.0 to 2.7.0. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.6.0...v2.7.0) --- updated-dependencies: - dependency-name: torch dependency-version: 2.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 09a282c..54aa787 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ Flask==3.1.0 clean-text==0.6.0 unidecode==1.3.8 spacy==3.8.4 -torch==2.6.0 +torch==2.7.0 transformers==4.50.2 ffmpeg-python==0.2.0 elevenlabs==1.55.0 From 8c693680915b74b65976a8de4fc0e227371da1d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 00:47:08 -0400 Subject: [PATCH 87/94] Bump transformers from 4.50.2 to 4.51.3 (#2289) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ef4368d..1272831 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.4.0 spacy==3.8.4 torch==2.7.0 -transformers==4.50.2 +transformers==4.51.3 ffmpeg-python==0.2.0 elevenlabs==1.57.0 yt-dlp==2025.3.27 From 450f5aec2136062e108a10f2ea2d2365c40a4ff8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 17:49:17 -0400 Subject: [PATCH 88/94] Bump spacy from 3.8.4 to 3.8.7 (#2310) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1272831..981958c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ tomlkit==0.13.2 Flask==3.1.0 clean-text==0.6.0 unidecode==1.4.0 -spacy==3.8.4 +spacy==3.8.7 torch==2.7.0 transformers==4.51.3 ffmpeg-python==0.2.0 From a086cf25aa30d43ecb41640127f6ad0979878086 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 17:49:38 -0400 Subject: [PATCH 89/94] Bump transformers from 4.51.3 to 4.52.3 (#2309) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 981958c..651195f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.4.0 spacy==3.8.7 torch==2.7.0 -transformers==4.51.3 +transformers==4.52.3 ffmpeg-python==0.2.0 elevenlabs==1.57.0 yt-dlp==2025.3.27 From 1f410033ea792c2a54f05db92fe22a658ad6a5e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 17:49:53 -0400 Subject: [PATCH 90/94] Bump yt-dlp from 2025.3.27 to 2025.5.22 (#2308) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 651195f..36130e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,4 @@ torch==2.7.0 transformers==4.52.3 ffmpeg-python==0.2.0 elevenlabs==1.57.0 -yt-dlp==2025.3.27 +yt-dlp==2025.5.22 From 35514b4e0e37bc3aa754e03995d382c7ff922f36 Mon Sep 17 00:00:00 2001 From: Cyteon <129582290+Cyteon@users.noreply.github.com> Date: Fri, 6 Jun 2025 19:27:27 +0200 Subject: [PATCH 91/94] Add back voice_choice to config template, fixes #2318 --- utils/.config.template.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/.config.template.toml b/utils/.config.template.toml index 4732782..9185a29 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -44,6 +44,7 @@ background_thumbnail_font_size = { optional = true, type = "int", default = 96, background_thumbnail_font_color = { optional = true, default = "255,255,255", example = "255,255,255", explanation = "Font color in RGB format for the thumbnail text" } [settings.tts] +voice_choice = { optional = false, default = "tiktok", options = ["elevenlabs", "streamlabspolly", "tiktok", "googletranslate", "awspolly", "pyttsx", "OpenAI"], example = "tiktok", explanation = "The voice platform used for TTS generation. " } random_voice = { optional = false, type = "bool", default = true, example = true, options = [true, false,], explanation = "Randomizes the voice used for each comment" } elevenlabs_voice_name = { optional = false, default = "Bella", example = "Bella", explanation = "The voice used for elevenlabs", options = ["Adam", "Antoni", "Arnold", "Bella", "Domi", "Elli", "Josh", "Rachel", "Sam", ] } elevenlabs_api_key = { optional = true, example = "21f13f91f54d741e2ae27d2ab1b99d59", explanation = "Elevenlabs API key" } @@ -58,4 +59,4 @@ no_emojis = { optional = false, type = "bool", default = false, example = false, openai_api_url = { optional = true, default = "https://api.openai.com/v1/", example = "https://api.openai.com/v1/", explanation = "The API endpoint URL for OpenAI TTS generation" } openai_api_key = { optional = true, example = "sk-abc123def456...", explanation = "Your OpenAI API key for TTS generation" } openai_voice_name = { optional = false, default = "alloy", example = "alloy", explanation = "The voice used for OpenAI TTS generation", options = ["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "af_heart"] } -openai_model = { optional = false, default = "tts-1", example = "tts-1", explanation = "The model variant used for OpenAI TTS generation", options = ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"] } \ No newline at end of file +openai_model = { optional = false, default = "tts-1", example = "tts-1", explanation = "The model variant used for OpenAI TTS generation", options = ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"] } From 7f8864be73213fe453a116253fbf61b1f28c2113 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:25:11 -0400 Subject: [PATCH 92/94] Bump transformers from 4.52.3 to 4.52.4 (#2316) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jason Cameron --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 36130e7..2a6a108 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ clean-text==0.6.0 unidecode==1.4.0 spacy==3.8.7 torch==2.7.0 -transformers==4.52.3 +transformers==4.52.4 ffmpeg-python==0.2.0 elevenlabs==1.57.0 yt-dlp==2025.5.22 From 3f5297b32a7f40ab0408a25f420e3b32e3f33f69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:25:20 -0400 Subject: [PATCH 93/94] Bump flask from 3.1.0 to 3.1.1 (#2301) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2a6a108..7bf8616 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ toml==0.10.2 translators==5.9.9 pyttsx3==2.98 tomlkit==0.13.2 -Flask==3.1.0 +Flask==3.1.1 clean-text==0.6.0 unidecode==1.4.0 spacy==3.8.7 From 37a184bdaf8e4cb31c5bf442ab9611b1dbe68ef3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 06:08:35 -0400 Subject: [PATCH 94/94] Bump moviepy from 2.1.2 to 2.2.1 (#2314) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7bf8616..720aea5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ boto3==1.36.8 botocore==1.36.8 gTTS==2.5.4 -moviepy==2.1.2 +moviepy==2.2.1 playwright==1.49.1 praw==7.8.1 requests==2.32.3