From e218ec5e7b269478fee04a8eca14ab7b8ac499fa Mon Sep 17 00:00:00 2001 From: Drugsosos <44712637+Drugsosos@users.noreply.github.com> Date: Mon, 11 Jul 2022 23:58:32 +0300 Subject: [PATCH] changed screenshot size aka viewport & fixed indexes of photo clips --- video_creation/data/videos.json | 11 ++++++++++- video_creation/final_video.py | 8 ++++---- video_creation/screenshot_downloader.py | 11 ++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/video_creation/data/videos.json b/video_creation/data/videos.json index 0637a08..5c92929 100644 --- a/video_creation/data/videos.json +++ b/video_creation/data/videos.json @@ -1 +1,10 @@ -[] \ No newline at end of file +[ + { + "subreddit": "AskReddit", + "id": "vwgslz", + "time": "1657573375", + "background_credit": "bbswitzer", + "reddit_title": "Which singer should never have been famous", + "filename": "Which singer should never have been famous.mp4" + } +] \ No newline at end of file diff --git a/video_creation/final_video.py b/video_creation/final_video.py index c13026f..46513b8 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -93,7 +93,7 @@ def make_final_video( indexes_for_videos = list() for idx, audio in track( - enumerate(indexes_of_clips, start=1), + enumerate(indexes_of_clips), description='Gathering audio clips...', ): temp_audio_clip = create_audio_clip( @@ -143,9 +143,9 @@ def make_final_video( image_clips.append( create_image_clip( f'comment_{photo_idx}', - audio_clips[photo_idx].start, - audio_clips[photo_idx].end, - audio_clips[photo_idx].duration + audio_clips[photo_idx + 1].start, + audio_clips[photo_idx + 1].end, + audio_clips[photo_idx + 1].duration ) ) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 81c7850..63be15f 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -85,7 +85,12 @@ class Browser: """ default_Viewport: dict = attrib( validator=instance_of(dict), - default=dict(), + default={ + 'defaultViewport': { + 'width': 500, + 'height': 900, + }, + }, kw_only=True, ) browser: Optional[BrowserCls] = attrib( @@ -94,10 +99,6 @@ class Browser: kw_only=True, ) - def __attrs_post_init__(self): - if self.default_Viewport.__len__() == 0: - self.default_Viewport['isLandscape'] = True - async def get_browser( self, ) -> None: