Last active
August 10, 2024 10:54
-
-
Save realyukii/06f2f92ced742ee4cf9217c1131afd51 to your computer and use it in GitHub Desktop.
track the related video based on MPV state
This file contains 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
#!/usr/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: match_md5.sh <video_path>" | |
exit 1 | |
fi | |
find "$1" -type f -exec sh -c ' | |
# another alternative for $HOME: readlink | |
MPV_STATE_PATH="$HOME/.local/state/mpv/watch_later" | |
for file; do | |
checksum=$(echo -n "$file" | md5sum | awk "{print \$1}" | sed "s/[a-z]/\U&/g" | tr -d "\n") | |
if [[ -e "$MPV_STATE_PATH/$checksum" ]]; then | |
echo "File $file matched with checksum $checksum" | |
else | |
echo "No match for $file with checksum $checksum" | |
fi | |
done | |
' sh {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related link: Gtihub Issue