From 7b50b4297ef5d098b47d7dbd0a41a367fb865e85 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 9 Aug 2022 21:29:55 -0400 Subject: [PATCH] reformatted --- utils/video.py | 4 +--- video_creation/data/videos.json | 12 +++++++++++- video_creation/final_video.py | 9 +++------ 3 files changed, 15 insertions(+), 10 deletions(-) mode change 100755 => 100644 video_creation/final_video.py diff --git a/utils/video.py b/utils/video.py index fc6ab74..b983c60 100644 --- a/utils/video.py +++ b/utils/video.py @@ -42,9 +42,7 @@ class Video: im.save(path) return ImageClip(path) - def add_watermark( - self, text, redditid, opacity=0.5, duration: int | float = 5, position: Tuple = (0.7, 0.9), fontsize=15 - ): + def add_watermark(self, text, redditid, opacity=0.5, duration: int | float = 5, position: Tuple = (0.7, 0.9), fontsize=15): compensation = round( (position[0] / ((len(text) * (fontsize / 5) / 1.5) / 100 + position[0] * position[0])), ndigits=2, diff --git a/video_creation/data/videos.json b/video_creation/data/videos.json index fe51488..db11168 100644 --- a/video_creation/data/videos.json +++ b/video_creation/data/videos.json @@ -1 +1,11 @@ -[] +[ + { + "subreddit": "AskReddit", + "id": "w2orm0", + "time": "1658271429", + "background_credit": "No Copyright Gameplay", + "reddit_title": "What comedian has never ever made you laugh", + "filename": "What comedian has never ever made you laugh.mp4" + } +] + diff --git a/video_creation/final_video.py b/video_creation/final_video.py old mode 100755 new mode 100644 index b243542..c6295aa --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -120,9 +120,7 @@ def make_final_video( # else: story mode stuff img_clip_pos = background_config[3] - image_concat = concatenate_videoclips(image_clips).set_position( - img_clip_pos - ) # note transition kwarg for delay in imgs + image_concat = concatenate_videoclips(image_clips).set_position(img_clip_pos) # note transition kwarg for delay in imgs image_concat.audio = audio_composite @@ -145,6 +143,7 @@ def make_final_video( # # lowered_audio = audio_background.multiply_volume( # todo get this to work # # VOLUME_MULTIPLIER) # lower volume by background_audio_volume, use with fx # final.set_audio(final_audio) + final = Video(final).add_watermark( text=f"Background credit: {background_config[2]}", opacity=0.4, redditid=reddit_obj ) @@ -173,6 +172,4 @@ def make_final_video( print_substep(f"Removed {cleanups} temporary files 🗑") print_substep("See result in the results folder!") - print_step( - f'Reddit title: {reddit_obj["thread_title"]} \n Background Credit: {background_config[2]}' - ) + print_step(f'Reddit title: {reddit_obj["thread_title"]} \n Background Credit: {background_config[2]}')