Help understanding Picard naming script system for noob

You actually got pretty far with looking up and understanding the individual function. Let’s just disassemble the default script then :slight_smile:

The first part is:

$if2(%albumartist%,%artist%)/

As you said before $if2(a1,a2) will give you the first non-empty value. So in this case you will get %albumartist% if set, otherwise %artist%. %albumartist% is the artist set for the entire album, %artist% is the artist for the individual track. So this $if2 ensures the album artist is used if available so you don’t scatter e.g. a compilation across multiple folders. The slash at the end just marks a folder separator. So this little part will give us a folder name like:

The Rolling Stones/

Next

$if($ne(%albumartist%,),%album%/)

The $if(if,then,else) will give us then, in this case the album name followed by a slash (the then is omitted here). The $ne here will be true, if %albumartist is true. Easy rule: If an album artist is set, create an album name folder. I think this handles the case of standalone recordings (those without an album). Usually the album artist is set. The result combined with the previous part is this:

The Rolling Stones/Beggars Banquet/
$if($gt(%totaldiscs%,1),%discnumber%-,)

This compares the total number of discs in the collection with one. If there is more than one disc, it will output the discnumber followed by a slash, e.g. 1- or 2-. If there is only one disc on the album it will do nothing (the empty ,)). We have only one disc, so let’s move on.

$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)

Similar to what we hade before this will only output something, if the album artist is not empty. In this case it will print the track number. With $num(value,2) the number will be formatted to have always 2 decimals, filled up with leading zeros. So we get something like 03 or 10:

The Rolling Stones/Beggars Banquet/01 
$if(%_multiartist%,%artist% - ,)

If this is an album with multiple artists it will output the artist name followed by a hyphen, e.g. "The Rolling stones - ". If it is only a single artist album this will be omitted.

%title%

And finally output the title. Picard will also add the proper file extension at the end, so the final result might be:

The Rolling Stones/Beggars Banquet/01 Sympathy for the Devil.mp3

A multi artist album with multiple discs could look something like this:

Various Artists/Century Media: Covering 20 Years of Extremes/2-04 The Agonist - Monochromatic Stains.mp3

So this is actually pretty close to what you want. To add the year maybe just edit the part $if($ne(%albumartist%,),%album%/) and use $left(%date%,4) - %album% instead of %album%. $left will give you just the first 4 characters of %date%, which is the year. If you want the original release year of that album (instead of the specific edition you have) use %originaldate%.

3 Likes