From e3eb67feeda06f66d4abb115eb90d027f83ca1db Mon Sep 17 00:00:00 2001 From: Ole <64090338+OlMi1@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:37:06 +0200 Subject: [PATCH 1/2] Add download progress bar --- video_creation/background.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/video_creation/background.py b/video_creation/background.py index 20dbe73..302f815 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -1,5 +1,6 @@ from random import randrange from pytube import YouTube +from pytube.cli import on_progress from pathlib import Path from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip from moviepy.editor import VideoFileClip @@ -23,7 +24,7 @@ def download_background(): "We need to download the Minecraft background video. This is fairly large but it's only done once. 😎" ) print_substep("Downloading the background video... please be patient 🙏") - YouTube("https://www.youtube.com/watch?v=n_Dv4JMiwK8").streams.filter( + YouTube("https://www.youtube.com/watch?v=n_Dv4JMiwK8", on_progress_callback=on_progress).streams.filter( res="720p" ).first().download( "assets/mp4", From 810f297171865d402ccf51bc3be7509868e68d80 Mon Sep 17 00:00:00 2001 From: Ole <64090338+OlMi1@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:37:57 +0200 Subject: [PATCH 2/2] and remove unnecessary line lol --- video_creation/background.py | 1 - 1 file changed, 1 deletion(-) diff --git a/video_creation/background.py b/video_creation/background.py index 302f815..d4b8e5f 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -12,7 +12,6 @@ def get_start_and_end_times(video_length, length_of_clip): random_time = randrange(180, int(length_of_clip) - int(video_length)) return random_time, random_time + video_length - def download_background(): """Downloads the background video from youtube.