From 0522d195daf29259d2c682fe76d116595e038968 Mon Sep 17 00:00:00 2001 From: cyteon Date: Sun, 19 May 2024 20:49:10 +0200 Subject: [PATCH] some fixes --- utils/.config.template.toml | 1 + utils/imagenarator.py | 8 -------- video_creation/screenshot_downloader.py | 5 +---- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/utils/.config.template.toml b/utils/.config.template.toml index 211cc97..f4a3af0 100644 --- a/utils/.config.template.toml +++ b/utils/.config.template.toml @@ -31,6 +31,7 @@ storymode_max_length = { optional = true, default = 1000, example = 1000, explan resolution_w = { optional = false, default = 1080, example = 1440, explantation = "Sets the width in pixels of the final video" } resolution_h = { optional = false, default = 1920, example = 2560, explantation = "Sets the height in pixels of the final video" } zoom = { optional = true, default = 1, example = 1.1, explanation = "Sets the browser zoom level. Useful if you want the text larger.", type = "float", nmin = 0.1, nmax = 2, oob_error = "The text is really difficult to read at a zoom level higher than 2" } +channel_name = { optional = true, default = "Reddit Tales", example = "Reddit Stories", explanation = "Sets the channel name for the video" } [settings.background] background_video = { optional = true, default = "minecraft", example = "rocket-league", options = ["minecraft", "gta", "rocket-league", "motor-gta", "csgo-surf", "cluster-truck", "minecraft-2","multiversus","fall-guys","steep", ""], explanation = "Sets the background for the video based on game name" } diff --git a/utils/imagenarator.py b/utils/imagenarator.py index 151b0e6..6ed22cf 100644 --- a/utils/imagenarator.py +++ b/utils/imagenarator.py @@ -56,25 +56,17 @@ def imagemaker(theme, reddit_obj: dict, txtclr, padding=5, transparent=False) -> """ Render Images for video """ - title = process_text(reddit_obj["thread_title"], False) texts = reddit_obj["thread_post"] id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) if transparent: font = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) - tfont = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) else: - tfont = ImageFont.truetype(os.path.join("fonts", "Roboto-Bold.ttf"), 100) # for title font = ImageFont.truetype(os.path.join("fonts", "Roboto-Regular.ttf"), 100) size = (1920, 1080) image = Image.new("RGBA", size, theme) - # for title - draw_multiple_line_text(image, title, tfont, txtclr, padding, wrap=30, transparent=transparent) - - image.save(f"assets/temp/{id}/png/title.png") - for idx, text in track(enumerate(texts), "Rendering Image"): image = Image.new("RGBA", size, theme) text = process_text(text, False) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index d314e6d..da7e6e0 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -58,6 +58,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): bgcolor = (255, 255, 255, 255) txtcolor = (0, 0, 0) transparent = False + if storymode and settings.config["settings"]["storymodemethod"] == 1: # for idx,item in enumerate(reddit_object["thread_post"]): print_substep("Generating images...") @@ -67,10 +68,6 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int): txtclr=txtcolor, transparent=transparent, ) - - if settings.config["settings"]["storymodemethod"] == 1: - print_substep("Storymodemethod 1 does not need screnshoots") - return screenshot_num: int with sync_playwright() as p: