Mwhahaha. Another waste of 45 minutes, for something I'll use once or twice more.
http://www.newbyproductions.net/downloads/id3tagger.shRequirements: bash shell,
id3lib (need the id3convert and id3tag binaries)
#/bin/bash
# ID3 tagger - written by newby (newbypwns@gmail.com, SPAMMERS BRING IT ON)
# Written with SOME of the terribly-tagged posts on Kerrazy in mind ;)
# Example usage: ./id3tagger.sh "Exodus/Exodus - 1985 - Bonded by Blood" 144
# Folders MUST be in format of: %artist - %year - %album/##-%songname.mp3
# Requirements: bash shell, id3lib (id3lib.sourceforge.net) (for the id3convert / id3tag binaries)
# Will fully tag your mp3s ID3v2 / ID3v1 :)
# Genre MUST be a number, so I included some common genres (again, common with kerrazy in mind) here.
# Feel free to modify/redistribute.
# Genres:
# Metal = 9
# Black Metal = 138
# Death Metal = 22
# Heavy Metal = 137
# Thrash Metal = 144
for i in "$1"/*.mp3
do
echo "\$i = $i"
FOLDERNAME=${i#*/}
FOLDERNAME=${FOLDERNAME%%/*}
FILENAME=${i##*/}
ARTIST=${FOLDERNAME%%" -"*}
ALBUM=${FOLDERNAME##*"- "}
YEAR=${FOLDERNAME#*" - "}
YEAR=${YEAR%%" - "*}
SONG=${FILENAME:3:${#FILENAME}-7}
NUMBER=${FILENAME:0:2}
if [ "$2" = "" ]
then
GENRE=137
else
declare -i GENRE=$2
fi
# echo "Foldername: $FOLDERNAME"
# echo "Filename: $FILENAME"
# echo "Artist Name: \"$ARTIST\""
# echo "Album Name: \"$ALBUM\""
# echo "Year: \"$YEAR\""
# echo "Song Name: \"$SONG\""
# echo "Song Number: $NUMBER"
id3convert --strip "$i"
id3tag --v2tag --artist="$ARTIST" --album="$ALBUM" --song="$SONG" --year="$YEAR" --track="$NUMBER" --genre="$GENRE" "$i"
id3tag --v1tag --artist="$ARTIST" --album="$ALBUM" --song="$SONG" --year="$YEAR" --track="$NUMBER" --genre="$GENRE" "$i"
done
Example output of parsing (taken from IRC):
<b00n> $i = Possessed/Possessed - 1985 - Seven Churches/10-Death Metal.mp3
<b00n> Foldername: Possessed - 1985 - Seven Churches
<b00n> Filename: 10-Death Metal.mp3
<b00n> Artist Name: "Possessed"
<b00n> Album Name: "Seven Churches"
<b00n> Year: "1985"
<b00n> Song Name: "Death Metal"
<b00n> Song Number: 10
Example output of tagging (heavily trimmed with nicely placed grep, warning the actual output is VERY verbose):
newby@impaler:~/music$ ./id3tagger.sh "Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law" 22 | grep "attempting"
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/01-In Battle There Is No Law.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/01-In Battle There Is No Law.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/01-In Battle There Is No Law.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/02-Challenge For Power.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/02-Challenge For Power.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/02-Challenge For Power.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/03-Forgotten Existence.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/03-Forgotten Existence.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/03-Forgotten Existence.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/04-Denial of Destiny.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/04-Denial of Destiny.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/04-Denial of Destiny.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/05-Blind to Defeat.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/05-Blind to Defeat.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/05-Blind to Defeat.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/06-Concession of Pain.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/06-Concession of Pain.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/06-Concession of Pain.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/07-Attack in the Aftermath.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/07-Attack in the Aftermath.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/07-Attack in the Aftermath.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/08-Psychological Warfare.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/08-Psychological Warfare.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/08-Psychological Warfare.mp3: attempting v1, tagged v1
Converting Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/09-Nuclear Annihilation.mp3: attempting v1 and v2, stripped v1 and v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/09-Nuclear Annihilation.mp3: attempting v2, tagged v2
Tagging Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law/09-Nuclear Annihilation.mp3: attempting v1, tagged v1
Example of parsed tag (as read by xmms):
Example of parsed tag (as read by id3info):
newby@impaler:~/music/Bolt Thrower/Bolt Thrower - 1988 - In Battle There Is No Law$ id3info "01-In Battle There Is No Law.mp3"
*** Tag information for 01-In Battle There Is No Law.mp3
=== TPE1 (Lead performer(s)/Soloist(s)): Bolt Thrower
=== TALB (Album/Movie/Show title): In Battle There Is No Law
=== TIT2 (Title/songname/content description): In Battle There Is No Law
=== TYER (Year): 1988
=== TCON (Content type): (22)
=== TRCK (Track number/Position in set): 1
*** mp3 info
MPEG1/layer III
Bitrate: 192KBps
Frequency: 44KHz
Comments? Concerns?