From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:23:46 +0000 (-0400) Subject: force works now with -av X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=986f0fc5010c6a8c60b680aad1c37afce73a7f38;p=youtube-downloader.git force works now with -av --- diff --git a/README.md b/README.md index 60e0dc8..ff1d3c4 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,4 @@ downloads the audio and video and stitches it together in the current directory. - [x] add stitched together - [x] add force replace - [ ] add album name -- [ ] add force replace check for audio and video only \ No newline at end of file +- [x] add force replace check for audio and video only \ No newline at end of file diff --git a/ytdl/__pycache__/funcmodule.cpython-312.pyc b/ytdl/__pycache__/funcmodule.cpython-312.pyc index f626c54..465528f 100644 Binary files a/ytdl/__pycache__/funcmodule.cpython-312.pyc and b/ytdl/__pycache__/funcmodule.cpython-312.pyc differ diff --git a/ytdl/funcmodule.py b/ytdl/funcmodule.py index 56c08e4..155396e 100644 --- a/ytdl/funcmodule.py +++ b/ytdl/funcmodule.py @@ -39,7 +39,15 @@ def download_thumbnail(thumbnail_url, thumbnail_filename): def download(link, mode, force=False): yt = YouTube(link) filename = fix_filename(yt.title) - if (filename + '.mp4' in glob.glob("*.mp4")) and not force: + if ( + ( + (mode == '-av' and + (filename + ' (audio only).mp4' in glob.glob("*.mp4") or + filename + ' (video only).mp4' in glob.glob("*.mp4"))) or + (mode != '-av' and filename + '.mp4' in glob.glob("*.mp4")) + ) and + (not force) + ): print(f"{yt.title} is already downloaded") return yt.check_availability()