Tag Archives: mp3tag

mp3tag (post_tag auto created by Wordpresser)

My favorite MP3TAG scripts

I use the free (as in “libre”) “mp3tag” software for tagging my music.
I was having a hard time with the file names of certain tracks with many artists and/or with too long album names, so I had to figure the internal scripting mechanisms of the software, for adequate file naming, from the music-embedded tags.

Fortunately, this open source tool provides good and succinct documentation for the task, available @ http://help.mp3tag.de/main_scripting.html

What follows, are my favorite naming strings. You enter them from the “Convert” menu, “Tag – Filename” option.

If you want to make sure that an album’s name is never longer than 32 characters, use this code for the album’s name part:

$if($geql($len(%album%),32),$left(%album%,32),%album%)

If you want to make sure that an artist’s name is never longer than 24 characters, use this code for the artist’s name part:
$if($geql($len(%artist%),24),$left(%artist%,24),%artist%)

In case of multiple artists for a single track, if you want to take only the first artist name, assuming the tags separate the names with commas, use:

$if($eql($strchr(%artist%,’,’),0),%artist%,$left(%artist%, $sub($strchr(%artist%,’,’),1))))

For the track numbering, if you want to force a specific number of digits, say 2, use this:

$num(%track%,2)

Now, combining all the above, here are the full scripts I actually use.
For the format “first artist name – album name no longer than 32 chars – track number with 3 digits”:

$if($eql($strchr(%artist%,','),0),%artist%,$left(%artist%, $sub($strchr(%artist%,','),1))) - $if($geql($len(%album%),32),$left(%album%,32),%album%) - $num(%track%,3)

For the format “artist name up to 24 chars – album name no longer than 32 chars – track number with 3 digits”:

$if($geql($len(%artist%),24),$left(%artist%,24),%artist%) - $if($geql($len(%album%),32),$left(%album%,32),%album%) - $num(%track%,3)

For the format “album name up to 32 chars – first artist name – track number with 3 digits”:

$if($geql($len(%album%),32),$left(%album%,32),%album%) - $if($eql($strchr(%artist%,','),0),%artist%,$left(%artist%, $sub($strchr(%artist%,','),1)))) - $num(%track%,3)

It may be helpful.