Adjusted code as per Drugsosos suggested

pull/1018/head
final 3 years ago
parent 91d8b90b3e
commit 74a602b42c

@ -13,7 +13,6 @@ 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
@ -39,7 +38,6 @@ 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)

@ -3,13 +3,13 @@ import toml
from rich.console import Console from rich.console import Console
import re import re
from typing import Tuple, Dict from typing import Tuple, Dict, Union
from utils.console import handle_input from utils.console import handle_input
console = Console() console = Console()
config: dict | None = None # autocomplete config: Union[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):

@ -19,13 +19,6 @@ from utils.videos import save_data
from utils import settings from utils import settings
console = Console() console = Console()
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:
@ -66,6 +59,11 @@ def make_final_video(
# except (TypeError, KeyError): # except (TypeError, KeyError):
# print('No background audio volume found in config.toml. Using default value of 1.') # print('No background audio volume found in config.toml. Using default value of 1.')
# VOLUME_MULTIPLIER = 1 # VOLUME_MULTIPLIER = 1
W: int = settings.config["settings"]["background"]["width"]
H: int = settings.config["settings"]["background"]["height"]
if not W or not H:
W, H = 1080, 1920
print_step("Creating the final video 🎥") print_step("Creating the final video 🎥")
VideoFileClip.reW = lambda clip: clip.resize(width=W) VideoFileClip.reW = lambda clip: clip.resize(width=W)
VideoFileClip.reH = lambda clip: clip.resize(width=H) VideoFileClip.reH = lambda clip: clip.resize(width=H)

Loading…
Cancel
Save