Skip to content

Instantly share code, notes, and snippets.

@LamberKeep
Last active June 8, 2024 16:59
Show Gist options
  • Save LamberKeep/d2cb7ee57e096c6453d1a94f1f5daafb to your computer and use it in GitHub Desktop.
Save LamberKeep/d2cb7ee57e096c6453d1a94f1f5daafb to your computer and use it in GitHub Desktop.
Renames files according pyzam result
#!/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