From adced74a0cb40b548038a8b97cf368a84beed562 Mon Sep 17 00:00:00 2001 From: Drugsosos <44712637+Drugsosos@users.noreply.github.com> Date: Wed, 13 Jul 2022 00:20:08 +0300 Subject: [PATCH] fixes with min_comments --- .config.template.toml | 2 +- utils/subreddit.py | 2 +- video_creation/background.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config.template.toml b/.config.template.toml index 18f1b00..08d654e 100644 --- a/.config.template.toml +++ b/.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 15 and 999999" } +min_comments = { default = 20, optional = false, nmin = 0, 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/utils/subreddit.py b/utils/subreddit.py index 4eb0108..c1efd0c 100644 --- a/utils/subreddit.py +++ b/utils/subreddit.py @@ -34,7 +34,7 @@ def get_subreddit_undone(submissions: list, subreddit): if submission.stickied: print_substep("This post was pinned by moderators. Skipping...") continue - if submission.num_comments <= int(settings.config["reddit"]["thread"]["min_comments"]): + if submission.num_comments < int(settings.config["reddit"]["thread"]["min_comments"]): print_substep( f'This post has under the specified minimum of comments ({settings.config["reddit"]["thread"]["min_comments"]}). Skipping...' ) diff --git a/video_creation/background.py b/video_creation/background.py index be0f46c..09daece 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -71,7 +71,7 @@ def get_background_config(): # Handle default / not supported background using default option. # Default : pick random from supported background. - if not choice or choice not in background_options: + if choice not in background_options: choice = random.choice(list(background_options.keys())) return background_options[choice]