Skip to content

Instantly share code, notes, and snippets.

@RealYukiSan
Last active August 10, 2024 10:54
Show Gist options
  • Save RealYukiSan/06f2f92ced742ee4cf9217c1131afd51 to your computer and use it in GitHub Desktop.
Save RealYukiSan/06f2f92ced742ee4cf9217c1131afd51 to your computer and use it in GitHub Desktop.
track the related video based on MPV state
#!/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 {} +
@RealYukiSan
Copy link
Author

related link: Gtihub Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment