review fixes

pull/963/head
Drugsosos 2 years ago
parent 720511168c
commit c69fb1b55e
No known key found for this signature in database
GPG Key ID: 8E35176FE617E28D

@ -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 = 1, 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 1 and 999999" }
[settings]
allow_nsfw = { optional = false, type = "bool", default = false, example = false, options = [true,
false,
@ -25,7 +25,7 @@ theme = { optional = false, default = "dark", example = "light", options = ["dar
"light",
], explanation = "sets the Reddit theme, either LIGHT or DARK" }
times_to_run = { optional = false, default = 1, example = 2, explanation = "used if you want to run multiple times. set to an int e.g. 4 or 29 or 1", type = "int", nmin = 1, oob_error = "It's very hard to run something less than once." }
opacity = { optional = false, default = 90, example = 80, explanation = "Sets the opacity (in percents) of the comments when overlayed over the background", type = "int", nmin = 10, nmax = 100, oob_error = "The opacity HAS to be between 10 and 100 percents", input_error = "The opacity HAS to be a number between 10 and 100" }
opacity = { optional = false, default = 0.9, example = 0.8, explanation = "Sets the opacity of the comments when overlayed over the background", type = "float", nmin = 0, nmax = 1, oob_error = "The opacity HAS to be between 0 and 1", input_error = "The opacity HAS to be a decimal number between 0 and 1" }
storymode = { optional = true, type = "bool", default = false, example = false, options = [true,
false,
], explanation = "not yet implemented" }

@ -124,11 +124,14 @@ def audio_length(
Returns:
length in seconds as an int
"""
from mutagen.mp3 import MP3
from moviepy.editor import AudioFileClip
try:
audio = MP3(path)
return audio.info.length
# please use something else here in the future
audio_clip = AudioFileClip(path)
audio_duration = audio_clip.duration
audio_clip.close()
return audio_duration
except Exception as e:
import logging

@ -72,8 +72,10 @@ class TTSEngine:
sync_tasks_primary = [
self.call_tts(str(idx), comment['comment_body'])
for idx, comment in track(enumerate(self.reddit_object['comments']), description='Saving...')
# Crunch, there will be fix in async TTS api
for idx, comment in track(
enumerate(self.reddit_object['comments']),
description='Saving...')
# Crunch, there will be fix in async TTS api, maybe
if self.__total_length + self.__total_length * 0.05 < self.max_length
]

Loading…
Cancel
Save