]> Skullheadx's Git Forge - youtube-downloader.git/commitdiff
force works now with -av
authorSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Mon, 14 Oct 2024 18:23:46 +0000 (14:23 -0400)
committerSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Mon, 14 Oct 2024 18:23:46 +0000 (14:23 -0400)
README.md
ytdl/__pycache__/funcmodule.cpython-312.pyc
ytdl/funcmodule.py

index 60e0dc8dcb87106f13901ac2a080e42f0be9a181..ff1d3c40ad1ddeb92bb70dbca302ad44084bd3da 100644 (file)
--- 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
index f626c540c08a40ca5875a81d5178bb0b3c1d4285..465528fb0122506ee47a790457731db06b157330 100644 (file)
Binary files a/ytdl/__pycache__/funcmodule.cpython-312.pyc and b/ytdl/__pycache__/funcmodule.cpython-312.pyc differ
index 56c08e4eb1eddf1a6300d55eb343676d1ecf827a..155396e67b21e96eaf7fd5857f6c682959c44ac8 100644 (file)
@@ -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()