I'm pretty new to bash scripting so some of the stuff is simple, most aren't.
What I'm looking for is a script that will read all my mp3 tags within a directory using id3info and rewrite them with a predefined format using id3tag.
What I do is move a group of mp3s to a directory named
couch'compilation or such, then I have to manually change the id3 tags on each one to include the artist in the title, rename the album to the directory name and change the artist to me and strip the current track number.
What I've got so far pretty much doesn't do anything.
Code:
#!/bin/bash -
#
# convert title to artist - title
#
function year {
id3info "$i" | grep TYER | cut -d":" -f2 | sed 's§ §§'
}
function genre {
id3info "$i" | grep TCON | cut -d":" -f2 | sed 's§ §§'
}
function title {
id3info "$i" | grep TIT2 | cut -d":" -f2 | sed 's§ §§'
}
function artist {
id3info "$i" | grep TPE1 | cut -d":" -f2 | sed 's§ §§'
}
function album {
id3info "$i" | grep TALB | cut -d":" -f2 | sed 's§ §§'
}
function track {
id3info "$i" | grep TRCK | cut -d":" -f2 | sed 's§ §§'
}
function bit {
id3info "$i" | grep Bitrate | cut -d":" -f2 | sed 's§ §§'
}
function freq {
id3info "$i" | grep Frequency | cut -d":" -f2 | sed 's§ §§'
}
for i in *.mp3
do
nice -n 19 id3tag -2 --song='$artist" - "$title' "$i"
done
and the output from id3tag and id3info
Code:
couch[test]$ id3info *.mp3
*** Tag information for 01 The Look of Love.mp3
=== TYER (Year): 0
=== TCON (Content type): New Wave
=== TIT2 (Title/songname/content description): The Look of Love
=== TPE1 (Lead performer(s)/Soloist(s)): ABC
=== TALB (Album/Movie/Show title): The Ultimate hits of the 80's
=== TRCK (Track number/Position in set): 1/109
*** mp3 info
MPEG1/layer III
Bitrate: 160KBps
Frequency: 44KHz
couch[test]$ id3tag --help
id3tag
Usage: id3tag [OPTIONS]... [FILES]...
-h --help Print help and exit
-V --version Print version and exit
-1 --v1tag Render only the id3v1 tag (default=off)
-2 --v2tag Render only the id3v2 tag (default=off)
-aSTRING --artist=STRING Set the artist information
-ASTRING --album=STRING Set the album title information
-sSTRING --song=STRING Set the title information
-cSTRING --comment=STRING Set the comment information
-CSTRING --desc=STRING Set the comment description
-ySTRING --year=STRING Set the year
-tSTRING --track=STRING Set the track number
-TSTRING --total=STRING Set the total number of tracks
-gSHORT --genre=SHORT Set the genre
-w --warning Turn on warnings (for debugging) (default=off)
-n --notice Turn on notices (for debugging) (default=off)
I really don't know what I've done wrong.
Any help would be very appreciated