From 0e1076549fcb9c6a550558131ea1e5355f2c055e Mon Sep 17 00:00:00 2001 From: iaacornus Date: Mon, 6 Jun 2022 22:08:28 +0800 Subject: [PATCH] little changes --- setup_program.py | 7 +++---- video_creation/final_video.py | 13 +++++-------- video_creation/voices.py | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/setup_program.py b/setup_program.py index a5bdd74..6800c14 100644 --- a/setup_program.py +++ b/setup_program.py @@ -8,10 +8,9 @@ from utils.console import print_markdown from utils.console import print_step -console = Console() - - def setup(): + console = Console() + if exists(".setup-done-before"): console.log( "[bold red]Setup was already done before! Please make" @@ -55,7 +54,7 @@ def setup(): theme = input("Theme? (light or dark) > ") # you can also put a while loop here, e.g. while VideoIsBeingMade == True: ... - console.log("[bold]Saving details...[/bold]") + console.log("Saving credentials...") os.remove(".env") with open('.env', 'a', encoding="utf-8") as f: f.write(f'REDDIT_CLIENT_ID="{cliID}"\n') diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 0ad5fee..eba61b8 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -16,22 +16,19 @@ import reddit.subreddit from utils.console import print_step, print_substep -W, H = 1080, 1920 - - def make_final_video(number_of_clips, file_name): load_dotenv() opacity = os.getenv("OPACITY") print_step("Creating the final video...") - VideoFileClip.reW = lambda clip: clip.resize(width=W) - VideoFileClip.reH = lambda clip: clip.resize(width=H) + VideoFileClip.reW = lambda clip: clip.resize(width=1080) + VideoFileClip.reH = lambda clip: clip.resize(width=1920) background_clip = ( VideoFileClip("assets/mp4/clip.mp4") .without_audio() - .resize(height=H) + .resize(height=1920) .crop(x1=1166.6, y1=0, x2=2246.6, y2=1920) ) @@ -72,7 +69,7 @@ def make_final_video(number_of_clips, file_name): ImageClip(f"assets/png/title.png") .set_duration(audio_clips[0].duration + audio_clips[1].duration) .set_position("center") - .resize(width=W - 100) + .resize(width=1080 - 100) .set_opacity(float(opacity)), ) else: @@ -81,7 +78,7 @@ def make_final_video(number_of_clips, file_name): ImageClip(f"assets/png/title.png") .set_duration(audio_clips[0].duration) .set_position("center") - .resize(width=W - 100) + .resize(width=1080 - 100) .set_opacity(float(opacity)), ) diff --git a/video_creation/voices.py b/video_creation/voices.py index e2eeb68..80372f1 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -26,7 +26,7 @@ def save_text_to_mp3(reddit_obj): try: Path(f"assets/mp3/posttext.mp3").unlink() - except OSError as e: + except OSError: pass if reddit_obj["thread_post"] != "":