From b1663f33816ad67fc672141cca6671a6502d850c Mon Sep 17 00:00:00 2001 From: Drugsosos <44712637+Drugsosos@users.noreply.github.com> Date: Tue, 19 Jul 2022 20:11:32 +0300 Subject: [PATCH] fixes in config & name[:30] in final_video --- utils/.config.template.toml | 2 +- video_creation/final_video.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/utils/.config.template.toml b/utils/.config.template.toml index be2c76f..d703fb3 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -16,7 +16,7 @@ subreddit = { optional = false, regex = "[_0-9a-zA-Z]+$", nmin = 3, explanation post_id = { optional = true, default = "", regex = "^((?!://|://)[+a-zA-Z])*$", explanation = "Used if you want to use a specific post.", example = "urdtfx" } max_comment_length = { default = 500, optional = false, nmin = 10, nmax = 10000, type = "int", explanation = "max number of characters a comment can have. default is 500", example = 500, oob_error = "the max comment length should be between 10 and 10000" } post_lang = { default = "", optional = true, explanation = "The language you would like to translate to.", example = "es-cr" } -min_comments = { default = 20, optional = false, nmin = 15, type = "int", explanation = "The minimum number of comments a post should have to be included. default is 20", example = 29, oob_error = "the minimum number of comments should be between 1 and 999999" } +min_comments = { default = 20, optional = false, nmin = 15, type = "int", explanation = "The minimum number of comments a post should have to be included. default is 20", example = 29, oob_error = "the minimum number of comments should be between 15 and 999999" } [settings] allow_nsfw = { optional = false, type = "bool", default = false, example = false, options = [true, false, diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 88ea499..14204e6 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -57,16 +57,15 @@ class FinalVideo: name = re.sub(r"(\d+)\s?/\s?(\d+)", r"\1 of \2", name) name = re.sub(r"(\w+)\s?/\s?(\w+)", r"\1 or \2", name) name = re.sub(r"/", "", name) - # name[:30] # does nothing lang = settings.config["reddit"]["thread"]["post_lang"] + translated_name = None if lang: import translators as ts print_substep("Translating filename...") translated_name = ts.google(name, to_language=lang) - return translated_name - return name + return translated_name[:30] if translated_name else name[:30] @staticmethod def create_audio_clip(