Mwhahaha. Another waste of 45 minutes, for something I'll use once or twice more. :P
http://www.newbyproductions.net/downloads/id3tagger.sh
Requirements: bash shell, id3lib (http://id3lib.sourceforge.net) (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):
Quote<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):
Quotenewby@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):
(http://www.newbyproductions.net/images/exampleoutput.jpg)
Example of parsed tag (as read by id3info):
Quotenewby@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? :)
Very nice! Hehe, saved my Carcass discography from having to be in the 1 - Compressed Albums folder for the rest of its life! :D
:-*
for i in ArtistName/*; do ./id3tagger.sh "$i"; done
That'll run recursively on a folder as long as it's named correctly. :)
Quote from: Newby on February 12, 2006, 03:20:34 PM
for i in ArtistName/*; do ./id3tagger.sh "$i"; done
That'll run recursively on a folder as long as it's tagged correctly. :)
Cool! My Pantera discography has fucked up ID3 tags too. I'll rename the directories and see if this fixes it! :)
How hard would it be to write a shell script that recursively renames the filenames?
QuotePantera\ -\ 01\ -\ Ride\ My\ Rocket.mp3*
Pantera\ -\ 02\ -\ I'll\ Be\ Alright.mp3*
Pantera\ -\ 03\ -\ Tell\ Me\ If\ You\ Want\ It.mp3*
Pantera\ -\ 04\ -\ Latest\ Lover.mp3*
Pantera\ -\ 05\ -\ Biggest\ Part\ Of\ Me.mp3*
Pantera\ -\ 06\ -\ Metal\ Magic.mp3*
Pantera\ -\ 07\ -\ Widowmaker.mp3*
Pantera\ -\ 08\ -\ Nothin'\ On\ (But\ The\ Radio).mp3*
Pantera\ -\ 09\ -\ Sad\ Lover.mp3*
Pantera\ -\ 10\ -\ Rock\ Out.mp3*
Pantera\ -\ Metal\ Magic\ Front.jpg*
Pretty hard.
Just stick to using rename on 'em.
Or do something like rename "Pantera - " "" */*.mp3 && rename " - " "-" */*.mp3 to see if that works.
I wouldn't try it unless you make a backup, though.
That worked, I think. I had a backup too!
Quotesidoh@deepthought:/mnt/hdb1/usr/pub/media/MUSIC/1 - Compressed Albums$ ls -l --block-size=M pantera.tar.bz2
-rwxr-xr-x 1 sidoh media 610M 2006-01-12 02:15 pantera.tar.bz2*
A quicker way for that ls: ls -lh <target>
Windows users are mad that they can't use this. :(
Quote from: Newby on February 12, 2006, 04:30:23 PM
Windows users are mad that they can't use this. :(
Haha, poor bastards. I wish there was a nice, open source id3 library for windows. ._.
http://sourceforge.net/project/showfiles.php?group_id=979
windows binaries = id3lib-3.8.3binaries.zip (http://prdownloads.sourceforge.net/id3lib/id3lib-3.8.3binaries.zip?download)
Oh well. Too bad the bash script isn't portable across OS'.
My bad. It is if you have a bash shell. Too bad you Windows users and your wsh suck.
Someone should port this to batch. :)
EDIT -- Warrior plans to port this to Monad's script language, so we'll see. :)
Newby, you forget the GNU/MinGW bash.
I used an ID3 retagger a while back for Windows...
MediaMonkey for Windows has batch [re]naming and batch [re]tagging, its what I use. I think there is still a free version or at least a free trial.
I wrote a couple Java programs which automatically convert file structure -> id3 or id3 -> proper file structure. The two programs are probably:
http://www.javaop.com/~iago/FixId3.jar
http://www.javaop.com/~iago/MoveMP3.jar
The source should be included in the .jar. They are in no way well written, but I use them all the time.