Skip to main content

Simplify the “save YouTube videos” script

ID
6eb9b2f
date
2024-04-01 12:57:42+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
34ee40f
message
Simplify the "save YouTube videos" script

The two styles of adding the video ID come from two different versions
of yt-dlp.  I've converted all my backups to the new style, so I don't
need to keep the code for the old style.
changed files
1 file, 1 addition, 6 deletions

Changed files

web/save_youtube_videos.py (6040) → web/save_youtube_videos.py (5850)

diff --git a/web/save_youtube_videos.py b/web/save_youtube_videos.py
index bbdd15c..c6f4d46 100755
--- a/web/save_youtube_videos.py
+++ b/web/save_youtube_videos.py
@@ -98,9 +98,6 @@ def classify_file_type(
 
     if filename.name.endswith(
         (
-            f"-{video_id}.mp4",
-            f"-{video_id}.webm",
-            f"-{video_id}.mkv",
             f" [{video_id}].mp4",
             f" [{video_id}].mkv",
             f" [{video_id}].webm",
@@ -110,15 +107,13 @@ def classify_file_type(
 
     if filename.name.endswith(
         (
-            f"-{video_id}.jpg",
-            f"-{video_id}.webp",
             f" [{video_id}].jpg",
             f" [{video_id}].webp",
         )
     ):
         return "thumbnail"
 
-    if filename.name.endswith((f"-{video_id}.info.json", f" [{video_id}].info.json")):
+    if filename.name.endswith(f" [{video_id}].info.json"):
         return "info"
 
     if filename.name.endswith(