electro199 2 years ago
commit 1d64b5c6c3

@ -87,8 +87,25 @@ def get_subreddit_threads(POST_ID: str):
threads = subreddit.hot(limit=25)
submission = get_subreddit_undone(threads, subreddit)
submission = check_done(submission) # double-checking
if submission is None or not submission.num_comments:
if submission is None:
return get_subreddit_threads(POST_ID) # submission already done. rerun
if settings.config["settings"]["storymode"]:
if not submission.selftext and settings.config["reddit"]["thread"]["post_id"] != "":
print_substep("You are trying to use story mode on post with no post text")
exit()
elif not submission.selftext:
print_substep("You are trying to use story mode on post with no post text")
return get_subreddit_threads(POST_ID)
else:
# Check for the length of the post text
if len(submission.selftext) > (settings.config["settings"]["storymode_max_length"] or 2000):
print_substep(
f"Post is too long ({len(submission.selftext)}), retrying with a different post. ({settings.config['settings']['storymode_max_length']} character limit)"
)
return get_subreddit_threads(POST_ID)
elif not submission.num_comments:
return get_subreddit_threads(POST_ID)
upvotes = submission.score
ratio = submission.upvote_ratio * 100
num_comments = submission.num_comments

@ -25,6 +25,7 @@ opacity = { optional = false, default = 0.9, example = 0.8, explanation = "Sets
transition = { optional = true, default = 0.2, example = 0.2, explanation = "Sets the transition time (in seconds) between the comments. Set to 0 if you want to disable it.", type = "float", nmin = 0, nmax = 2, oob_error = "The transition HAS to be between 0 and 2", input_error = "The opacity HAS to be a decimal number between 0 and 2" }
storymode = { optional = true, type = "bool", default = false, example = false, options = [true, false,], explanation = "Only read out title and post content, great for subreddits with stories" }
storymodemethod= { optional = true, default = 1, example = 1, explanation = "Style that's used for the storymode. Set to 0 for single picture display in whole video, set to 1 for fancy looking video ", type = "int", nmin = 0, oob_error = "It's very hard to run something less than once.", options = [0, 1] }
storymode_max_length = { optional = true, default = 1000, example = 1000, explanation = "Max length of the storymode video in characters. 200 characters are approximately 50 seconds.", type = "int", nmin = 1, oob_error = "It's very hard to make a video under a second." }
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" }

@ -38,7 +38,7 @@ def get_subreddit_undone(submissions: list, subreddit, times_checked=0):
continue
if submission.num_comments <= int(
settings.config["reddit"]["thread"]["min_comments"]
):
) and not settings.config["settings"]["storymode"]:
print_substep(
f'This post has under the specified minimum of comments ({settings.config["reddit"]["thread"]["min_comments"]}). Skipping...'
)

Loading…
Cancel
Save