Created
March 30, 2020 09:49
-
-
Save Gydo194/58ecbc05bcede1c88b5d04627c27417a to your computer and use it in GitHub Desktop.
id3v2 directory tagger
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 | |
if [ $# -eq 0 ]; then | |
echo "Need directory argument" | |
exit | |
fi | |
if [ ! -d $1 ]; then | |
echo "Given path is not a directory" | |
exit | |
fi | |
for FILE in $1/*; do | |
if [[ ! `id3v2 -l $FILE | fgrep "No ID3 tag"` ]]; then | |
printf "Skipping already tagged file %s\n\n" $FILE | |
continue; # skip this file as it's already tagged | |
fi | |
printf "Tagging %s:\n" $FILE | |
printf "Artist:\n" | |
read ARTIST | |
printf "Title:\n" | |
read TITLE | |
printf "%s: %s by %s\n" $FILE $TITLE $ARTIST | |
id3v2 -2 -a $ARTIST -t $TITLE $FILE | |
if [ $? -eq 0 ]; then | |
printf "Done tagging %s\n\n" $FILE | |
else | |
printf "Failed to tag %s!\n\n" $FILE | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment