From 4e70ad5f1c599869e6f5ab1762c5595ad6142119 Mon Sep 17 00:00:00 2001 From: Josh Greenwood Date: Mon, 25 Jul 2022 08:10:22 +0100 Subject: [PATCH] Added video_length in config --- TTS/engine_wrapper.py | 6 ++---- utils/.config.template.toml | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 6d09c7a..7cc2419 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -13,7 +13,7 @@ from utils.console import print_step, print_substep from utils.voice import sanitize_text from utils import settings -DEFAULT_MAX_LENGTH: int = 50 # video length variable + class TTSEngine: @@ -24,7 +24,6 @@ class TTSEngine: tts_module : The TTS module. Your module should handle the TTS itself and saving to the given path under the run method. reddit_object : The reddit object that contains the posts to read. path (Optional) : The unix style path to save the mp3 files to. This must not have leading or trailing slashes. - max_length (Optional) : The maximum length of the mp3 files in total. Notes: tts_module must take the arguments text and filepath. @@ -35,13 +34,12 @@ class TTSEngine: tts_module, reddit_object: dict, path: str = "assets/temp/mp3", - max_length: int = DEFAULT_MAX_LENGTH, last_clip_length: int = 0, ): self.tts_module = tts_module() self.reddit_object = reddit_object self.path = path - self.max_length = max_length + self.max_length = settings.config["settings"]["video_length"] self.length = 0 self.last_clip_length = last_clip_length diff --git a/utils/.config.template.toml b/utils/.config.template.toml index d783349..e5be1c5 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -21,6 +21,7 @@ min_comments = { default = 20, optional = false, nmin = 15, type = "int", explan allow_nsfw = { optional = false, type = "bool", default = false, example = false, options = [true, false, ], explanation = "Whether to allow NSFW content, True or False" } +video_length = { default = 50, optional = false, nmin = 20, nmax = 3600, type = "int", explanation = "The minimum length of a video in seconds. default is 50", example = 25, oob_error = "the length of the video should be between 20 and 3600 seconds" } theme = { optional = false, default = "dark", example = "light", options = ["dark", "light", ], explanation = "sets the Reddit theme, either LIGHT or DARK" }