From ad5c814da416ba691e9ea69bf43a5d698f6cf398 Mon Sep 17 00:00:00 2001 From: electro199 Date: Sat, 4 Feb 2023 17:11:37 +0500 Subject: [PATCH] added Max video lenght option in config file --- utils/.config.template.toml | 1 + video_creation/voices.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/utils/.config.template.toml b/utils/.config.template.toml index ec5bb2a..9d5c900 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -32,6 +32,7 @@ storymode_max_length = { optional = true, default = 1000, example = 1000, explan fps = { optional = false, default = 30, example = 30, explanation = "Sets the FPS of the video, 30 is default for best performance. 60 FPS is smoother.", type = "int", nmin = 1, nmax = 60, oob_error = "The FPS HAS to be between 1 and 60" } resolution_w = { optional = false, default = 1080, example = 1440, explantation = "Sets the width in pixels of the final video" } resolution_h = { optional = false, default = 1920, example = 2560, explantation = "Sets the height in pixels of the final video" } +max_video_lenght = { optional = false, default = 50, example = 30, explantation = "Sets the max lenght of the final video in seconds" type = "int",nmin = 5 } [settings.background] background_choice = { optional = true, default = "minecraft", example = "rocket-league", options = ["minecraft", "gta", "rocket-league", "motor-gta", "csgo-surf", "cluster-truck", "minecraft-2","multiversus","fall-guys","steep", ""], explanation = "Sets the background for the video based on game name" } diff --git a/video_creation/voices.py b/video_creation/voices.py index 425f589..58703c8 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -33,11 +33,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 - ) - else: + if not str(voice).casefold() in map(lambda _: _.casefold(), TTSProviders): while True: print_step("Please choose one of the following TTS providers: ") print_table(TTSProviders) @@ -45,8 +41,9 @@ 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 + get_case_insensitive_key_value(TTSProviders, choice), reddit_obj , max_length = settings.config["settings"]["len"] ) return text_to_mp3.run()