reformatting and additional toml variables

reformatted toml to be consistent
added variables, sort, sort time and silence duration
these variables will interact with the additional options I have added
pull/915/head
anthony lloyd 3 years ago
parent 4f68b276f8
commit f67b6e802d

@ -1,40 +1,32 @@
[reddit.creds] [reddit.creds]
client_id = { optional = false, nmin = 12, nmax = 30, explanation = "the ID of your Reddit app of SCRIPT type", example = "fFAGRNJru1FTz70BzhT3Zg", regex = "^[-a-zA-Z0-9._~+/]+=*$", input_error = "The client ID can only contain printable characters.", oob_error = "The ID should be over 12 and under 30 characters, double check your input." } client_id = { optional = false, example = "fFAGRNJru1FTz70BzhT3Zg", explanation = "the ID of your Reddit app of SCRIPT type", default = "", nmin = 12, nmax = 30, regex = "^[-a-zA-Z0-9._~+/]+=*$", oob_error = "The ID should be over 12 and under 30 characters, double check your input.", input_error = "The client ID can only contain printable characters." }
client_secret = { optional = false, nmin = 20, nmax = 40, explanation = "the SECRET of your Reddit app of SCRIPT type", example = "fFAGRNJru1FTz70BzhT3Zg", regex = "^[-a-zA-Z0-9._~+/]+=*$", input_error = "The client ID can only contain printable characters.", oob_error = "The secret should be over 20 and under 40 characters, double check your input." } client_secret = { optional = false, example = "fFAGRNJru1FTz70BzhT3Zg", explanation = "the SECRET of your Reddit app of SCRIPT type", default = "", nmin = 20, nmax = 40, regex = "^[-a-zA-Z0-9._~+/]+=*$", oob_error = "The secret should be over 20 and under 40 characters, double check your input.", input_error = "The client ID can only contain printable characters." }
username = { optional = false, nmin = 3, nmax = 20, explanation = "the username of your reddit account", example = "JasonLovesDoggo", regex = "^[-_0-9a-zA-Z]+$", oob_error = "A username HAS to be between 3 and 20 characters" } username = { optional = false, example = "JasonLovesDoggo", explanation = "the username of your reddit account", default = "", nmin = 3, nmax = 20,regex = "^[-_0-9a-zA-Z]+$", oob_error = "A username HAS to be between 3 and 20 characters" }
password = { optional = false, nmin = 8, explanation = "the password of your reddit account", example = "fFAGRNJru1FTz70BzhT3Zg", oob_error = "Password too short" } password = { optional = false, example = "fFAGRNJru1FTz70BzhT3Zg", explanation = "the password of your reddit account", default = "", nmin = 8, oob_error = "Password too short" }
2fa = { optional = true, type = "bool", options = [true, 2fa = { optional = true, example = "True", explanation = "Whether you have Reddit 2FA enabled, Valid options are True and False", default = false, options = [true, false], type = "bool" }
false,
], default = false, explanation = "Whether you have Reddit 2FA enabled, Valid options are True and False", example = true }
[reddit.thread] [reddit.thread]
random = { optional = true, options = [true, random = { optional = true, example = "True", explanation = "If set to no, it will ask you a thread link to extract the thread, if yes it will randomize it.", default = false, options = [true, false, ], type = "bool" }
false, subreddit = { optional = false, example = "AskReddit", explanation = "what subreddit to pull posts from, the name of the sub, not the URL", default = "", nmin = 3, nmax = 21,regex = "[_0-9a-zA-Z]+$", oob_error = "A subreddit name HAS to be between 3 and 20 characters" }
], default = false, type = "bool", explanation = "If set to no, it will ask you a thread link to extract the thread, if yes it will randomize it. Default: 'False'", example = "True" } post_id = { optional = true, example = "urdtfx", explanation = "Used if you want to use a specific post.", default = "", regex = "^((?!://|://)[+a-zA-Z])*$" }
subreddit = { optional = false, regex = "[_0-9a-zA-Z]+$", nmin = 3, nmax = 21, explanation = "what subreddit to pull posts from, the name of the sub, not the URL", example = "AskReddit", oob_error = "A subreddit name HAS to be between 3 and 20 characters" } max_comment_length = { optional = false, example = 500, explanation = "max number of characters a comment can have. default is 500", default = 500, type = "int", nmin = 10, nmax = 10000, oob_error = "the max comment length should be between 10 and 10000" }
post_id = { optional = true, default = "", regex = "^((?!://|://)[+a-zA-Z])*$", explanation = "Used if you want to use a specific post.", example = "urdtfx" } post_lang = { optional = true, example = "es-cr", explanation = "The language you would like to translate to.", default = "" }
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" } sort = { optional = true, example = "hot ,top, relevance, new", explanation = "method of sorting threads", default = "top", options = ["hot", "top", "relevance", "new"] }
post_lang = { default = "", optional = true, explanation = "The language you would like to translate to.", example = "es-cr" } sort_time = { optional = true, example = "day, hour, week, month, year, all", explanation = "time range to gather threads from", default = "all", options = ["day", "hour", "week", "month", "year", "all"] }
random = { optional = true, example = "True", explanation = "If set to no, it will ask you a thread link to extract the thread, if yes it will randomize it.", default = false, options = [true, false], type = "bool" }
[settings] [settings]
allow_nsfw = { optional = false, type = "bool", default = false, example = false, options = [true, allow_nsfw = { optional = false, example = "false", explanation = "Whether to allow NSFW content, True or False", default = false, options = [true, false], type = "bool" }
false, theme = { optional = false, example = "light, dark", explanation = "sets the Reddit theme, either LIGHT or DARK", default = "dark", options = ["dark", "light"] }
], explanation = "Whether to allow NSFW content, True or False" } times_to_run = { optional = false, example = 2, explanation = "used if you want to run multiple times. set to an int e.g. 4 or 29 or 1", default = 1, type = "int", nmin = 1, oob_error = "It's very hard to run something less than once." }
theme = { optional = false, default = "dark", example = "light", options = ["dark", opacity = { optional = false, example = 0.8, explanation = "Sets the opacity of the comments when overlayed over the background", default = 0.9, 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" }
"light", storymode = { optional = true, example = false, explanation = "not yet implemented", default = false, options = [true, false], type = "bool" }
], explanation = "sets the Reddit theme, either LIGHT or DARK" } background_choice = { optional = true, example = "minecraft", explanation = "Sets the background for the video", default = "minecraft", options = ["minecraft", "gta", "rocket-league", "motor-gta",] }
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." } background_audio = { optional = true, example = false, explaination = "Sets a audio to play in the background (put a background.mp3 file in the assets/backgrounds directory for it to be used.)", default = false, options = [true, false], type = "bool" }
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" }
background_choice = { optional = true, default = "minecraft", example = "minecraft", options = ["minecraft", "gta", "rocket-league", "motor-gta", ""], explanation = "Sets the background for the video" }
background_audio = { optional = true, type = "bool", default = false, example = false, options = [true,
false,
], explaination="Sets a audio to play in the background (put a background.mp3 file in the assets/backgrounds directory for it to be used.)" }
[settings.tts] [settings.tts]
choice = { optional = false, default = "", options = ["streamlabspolly", "tiktok", "googletranslate", "awspolly", ], example = "streamlabspolly", explanation = "The backend used for TTS generation. This can be left blank and you will be prompted to choose at runtime." } choice = { optional = false, example = "streamlabspolly", explanation = "The backend used for TTS generation. This can be left blank and you will be prompted to choose at runtime.", default = "", options = ["streamlabspolly", "tiktok", "googletranslate", "awspolly", "blank"] }
aws_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for AWS Polly" } aws_polly_voice = { optional = false, example = "Matthew", explanation = "The voice used for AWS Polly", default = "Matthew" }
streamlabs_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for Streamlabs Polly" } streamlabs_polly_voice = { optional = false, example = "Matthew", explanation = "The voice used for Streamlabs Polly", default = "Matthew" }
tiktok_voice = { optional = false, default = "en_us_006", example = "en_us_006", explanation = "The voice used for TikTok TTS" } tiktok_voice = { optional = false, example = "en_us_006", explanation = "The voice used for TikTok TTS", default = "en_us_006" }
silence_duration = { optional = true, example = "0.1", explanation = "time in seconds between TTS comments", default = 0.3, type = "float" }

@ -85,7 +85,10 @@ class TTSEngine:
x.group().strip() x.group().strip()
for x in re.finditer(rf" *((.{{0,{self.tts_module.max_chars}}})(\.|.$))", text) for x in re.finditer(rf" *((.{{0,{self.tts_module.max_chars}}})(\.|.$))", text)
] ]
silence_duration = settings.config["settings"]["tts"]["silence_duration"] try:
silence_duration = settings.config["settings"]["tts"]["silence_duration"]
except ValueError:
silence_duration = 0.3
silence_long = AudioClip(make_frame=lambda t: np.sin(440 * 2 * np.pi * t), duration=silence_duration, fps=44100) silence_long = AudioClip(make_frame=lambda t: np.sin(440 * 2 * np.pi * t), duration=silence_duration, fps=44100)
silence_long_new = volumex(silence_long, 0) silence_long_new = volumex(silence_long, 0)

Loading…
Cancel
Save