Last active
June 8, 2024 16:59
-
-
Save LamberKeep/d2cb7ee57e096c6453d1a94f1f5daafb to your computer and use it in GitHub Desktop.
Renames files according pyzam result
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
#!/bin/bash | |
# pyzamrename.sh | |
# Renames files according pyzam result | |
set -e | |
input=$(pyzam --input "$@") | |
artist=$(echo "$input" | grep 'Artist:' | cut -d ':' -f 2 | cut -c 2-) | |
if [ -z "$artist" ]; then | |
echo $input | |
exit 2 | |
fi | |
track=$(echo "$input" | grep 'Track:' | cut -d ':' -f 2 | cut -c 2-) | |
output="$(dirname "$1")/$artist - $track.${1##*.}" | |
mv "$1" "$output" | |
echo "$1 > $output" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment