From e9d3f63edadb691a711442c047d1cceb8956dbe0 Mon Sep 17 00:00:00 2001 From: iaacornus Date: Sun, 5 Jun 2022 12:06:29 +0800 Subject: [PATCH] use os to remove the already downloaded background --- video_creation/background.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/video_creation/background.py b/video_creation/background.py index a1897c6..12f5fe8 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -1,7 +1,7 @@ import re +import os from random import randrange from pathlib import Path -from turtle import back from yt_dlp import YoutubeDL from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip @@ -31,10 +31,11 @@ def download_background(background): background_check = Path("assets/mp4/background.mp4").is_file() if background is not None or not background_check: - if background_check: + if background_check and background is not None: print_substep( "Background video is already downloaded! Replacing ...", style="bold red" ) + os.system("rm assets/mp4/background.mp4") try: with YoutubeDL(ydl_opts) as ydl: