works for me

pull/2070/head
cyteon 1 year ago
parent a655ae9825
commit e4c5f9bc6c

@ -111,7 +111,8 @@ class TTSEngine:
else: # If the comment is not too long, just call the tts engine
self.call_tts(f"{idx}", process_text(comment["comment_body"]))
comment_image_maker((0, 0, 0, 0), self.reddit_object, comments, (255, 255, 255), transparent=True)
if settings.config["settings"]["storymodemethod"] != 0:
comment_image_maker((0, 0, 0, 0), self.reddit_object, comments, (255, 255, 255), transparent=True)
print_substep("Saved Text to MP3 files successfully.", style="bold green")
return self.length, idx

@ -36,7 +36,7 @@ def generate_captions(file_path, title):
page.click("//span[contains(text(),'OK')]")
page.click("//span[contains(text(),'Sign in')]")
page.goto("https://www.capcut.com/login")
page.fill("//input[@class='lv-input lv-input-size-default lv_sign_in_panel_wide-input']", email)
@ -62,7 +62,8 @@ def generate_captions(file_path, title):
except:
pass
page.click("//div[@class='guide-modal-close-icon']")
if page.is_visible("//div[@class='guide-modal-close-icon']"):
page.click("//div[@class='guide-modal-close-icon']")
if page.is_visible("//div[@data-selectable-item-id]"):
@ -84,17 +85,26 @@ def generate_captions(file_path, title):
page.goto("https://www.capcut.com/editor?enter_from=create_new&current_page=landing_page&from_page=work_space&start_tab=video&__action_from=my_draft&position=my_draft&scenario=youtube_ads&scale=9%3A16")
page.click("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']")
if page.is_visible("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']"):
page.click("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']")
if page.is_visible("//div[@class='guide-placeholder-before-OsTdXF']"):
page.click("//div[@class='guide-placeholder-before-OsTdXF']")
if page.is_visible("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']"):
page.click("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']")
page.click("//div[@class='guide-placeholder-before-OsTdXF']")
if page.is_visible("//div[@class='guide-close-icon-Gtxdju']//*[name()='svg']"):
page.click("//div[@class='guide-close-icon-Gtxdju']//*[name()='svg']")
page.click("//div[@class='guide-close-icon-f8J9FZ']//*[name()='svg']")
if page.is_visible("//div[@class='guide-close-icon-Gtxdju']"):
page.click("//div[@class='guide-close-icon-Gtxdju']")
page.set_input_files("(//input[@type='file'])[1]", file_path)
time.sleep(2)
page.click("//div[@class='tools-ZGlCP0']")
page.click("//div[@class='tools-dCzTyg']")
page.click("(//li[@role='option'])[5]")
time.sleep(18)
@ -127,7 +137,7 @@ def generate_captions(file_path, title):
time.sleep(1)
page.click(f"(//img[@class='image-DUnWNW'])[{str(settings.config['capcut']['preset_number'])}]")
page.click(f"(//img[@class='image-QII91y'])[{str(settings.config['capcut']['preset_number'])}]")
time.sleep(2)

@ -349,17 +349,18 @@ def make_final_video(
"scale", screenshot_width, -1
)
)
if i == 0:
time_for_clip = float(ffmpeg.probe(f"assets/temp/{reddit_id}/mp3/title.mp3")["format"]["duration"])
image_overlay = image_clips[i].filter("colorchannelmixer", aa=opacity)
background_clip = background_clip.overlay(
image_overlay,
enable=f"between(t,{current_time},{current_time + time_for_clip})",
x="(main_w-overlay_w)/2",
y="(main_h-overlay_h)/2",
)
current_time += time_for_clip
image_overlay = image_clips[i].filter("colorchannelmixer", aa=opacity)
background_clip = background_clip.overlay(
image_overlay,
enable=f"between(t,{current_time},{current_time + time_for_clip})",
x="(main_w-overlay_w)/2",
y="(main_h-overlay_h)/2",
)
current_time += time_for_clip
title = re.sub(r"[^\w\s-]", "", reddit_obj["thread_title"])
idx = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"])

@ -11,7 +11,7 @@ from rich.progress import track
from utils import settings
from utils.console import print_step, print_substep
from utils.imagenarator import imagemaker, comment_image_maker
from utils.imagenarator import imagemaker
from utils.playwright import clear_cookie_by_name
from utils.videos import save_data

Loading…
Cancel
Save