Last active
October 2, 2021 04:19
-
-
Save hypevhs/45f2603078b8ae94983fe61bc31ccb4e to your computer and use it in GitHub Desktop.
yt-dlp check consistent filenames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DEPRECATED | |
# in a directory filled with yt-dlp saved items, we want filenames for | |
# metadata/thumbnails/video/etc to be exactly the same up until the extension. | |
# sometimes this doesn't happen due to e.g. a change in channel name or video title. | |
# for each video ID in this dir, print out the video IDs where the filenames (minus extensions) do not match. | |
find . -maxdepth 1 -type f -regextype grep -regex '.*\[[a-zA-Z0-9_-]\{11\}\]\..*' -printf '%f\n' | grep -Po '(?<= \[).{11}(?=\]\.)' | sort -u | while read f; do if ! for ff in *"${f}"*; do echo "$ff" | sed 's_\.\(\(info\|live\_chat\)\.json\|mkv\|mp4\|webp\|jpg\|[a-z]\{2,3\}\(-[A-Za-z0-9_-]\{2,14\}\)\?\.vtt\)$__'; done | sort -u | wc -l | grep -Eq '^1$'; then echo "$f"; fi; done | |
# inspect a single ID | |
for f in *W3_BIZLuXuw*; do echo "$f"; done | sed 's_\.\(\(info\|live\_chat\)\.json\|mkv\|mp4\|webp\|jpg\|[a-z]\{2,3\}\(-[A-Za-z0-9_-]\{2,14\}\)\?\.vtt\)$__' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment