Allowed for video resolution changes to occur, as per #943

pull/1018/head
final 3 years ago
parent 2cfd20b566
commit 91d8b90b3e

@ -32,6 +32,8 @@ storymode = { optional = true, type = "bool", default = false, example = false,
[settings.background] [settings.background]
background_choice = { optional = true, default = "minecraft", example = "minecraft", options = ["minecraft", "gta", "rocket-league", "motor-gta", ""], explanation = "Sets the background for the video" } background_choice = { optional = true, default = "minecraft", example = "minecraft", options = ["minecraft", "gta", "rocket-league", "motor-gta", ""], explanation = "Sets the background for the video" }
width = { optional = true, default = 1080, example = 1080, explanation = "Sets the width resolution for the video", type = "int", nmin = 1, oob_error = "The width HAS to be greater than 1", input_error = "The width HAS to be an integer greater than 1" }
height = { optional = true, default = 1920, example = 1920, explanation = "Sets the height resolution for the video", type = "int", nmin = 1, oob_error = "The height HAS to be greater than 1", input_error = "The height HAS to be an integer greater than 1" }
#background_audio = { optional = true, type = "bool", default = false, example = false, options = [true, #background_audio = { optional = true, type = "bool", default = false, example = false, options = [true,
# false, # 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.)" } #], explaination="Sets a audio to play in the background (put a background.mp3 file in the assets/backgrounds directory for it to be used.)" }
@ -42,4 +44,4 @@ background_choice = { optional = true, default = "minecraft", example = "minecra
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, 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." }
aws_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for AWS Polly" } aws_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for AWS Polly" }
streamlabs_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for Streamlabs Polly" } streamlabs_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for Streamlabs Polly" }
tiktok_voice = { optional = false, default = "en_us_006", example = "en_us_006", explanation = "The voice used for TikTok TTS" } tiktok_voice = { optional = false, default = "en_us_006", example = "en_us_006", explanation = "The voice used for TikTok TTS" }

@ -13,6 +13,7 @@ from video_creation.background import (
get_background_config, get_background_config,
) )
from video_creation.final_video import make_final_video from video_creation.final_video import make_final_video
from video_creation.final_video import change_background_resolution
from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts
from video_creation.voices import save_text_to_mp3 from video_creation.voices import save_text_to_mp3
@ -38,6 +39,7 @@ print_step(f"You are using v{__VERSION__} of the bot")
def main(POST_ID=None): def main(POST_ID=None):
cleanup() cleanup()
change_background_resolution()
reddit_object = get_subreddit_threads(POST_ID) reddit_object = get_subreddit_threads(POST_ID)
length, number_of_comments = save_text_to_mp3(reddit_object) length, number_of_comments = save_text_to_mp3(reddit_object)
length = math.ceil(length) length = math.ceil(length)

@ -9,7 +9,7 @@ from utils.console import handle_input
console = Console() console = Console()
config = dict # autocomplete config: dict | None = None # autocomplete
def crawl(obj: dict, func=lambda x, y: print(x, y, end="\n"), path=None): def crawl(obj: dict, func=lambda x, y: print(x, y, end="\n"), path=None):

@ -22,6 +22,12 @@ console = Console()
W, H = 1080, 1920 W, H = 1080, 1920
def change_background_resolution():
global W
global H
W, H = settings.config["settings"]["background"]["width"], settings.config["settings"]["background"]["height"]
def name_normalize(name: str) -> str: def name_normalize(name: str) -> str:
name = re.sub(r'[?\\"%*:|<>]', "", name) name = re.sub(r'[?\\"%*:|<>]', "", name)
name = re.sub(r"( [w,W]\s?\/\s?[o,O,0])", r" without", name) name = re.sub(r"( [w,W]\s?\/\s?[o,O,0])", r" without", name)
@ -43,10 +49,10 @@ def name_normalize(name: str) -> str:
def make_final_video( def make_final_video(
number_of_clips: int, number_of_clips: int,
length: int, length: int,
reddit_obj: dict, reddit_obj: dict,
background_config: Tuple[str, str, str, Any], background_config: Tuple[str, str, str, Any],
): ):
"""Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp """Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp
Args: Args:

Loading…
Cancel
Save