Rename Various Artists to Compiler/DJ/Label script debug help?

I’m trying to automatically replace “Various Artists” album artist tags with the Compiler/DJ, or if that’s not available, with the label (I hate VA, I find it useless. I know this is not for everyone).

I’m using this script:

$if($and($eq(%compilation%,1), $eq(%albumartist%,Various Artists)),
    $set(albumartist, $if2(%compiler%, %djmixer%, %label%)))
    $set(albumartistsort, $if2(%compiler%, %djmixer%, %label%))))

It works for e.g., but it isn’t working for either or, and I can’t figure out why, because both of the latter releases have suitable tags…

Can anyone help me figure out what’s wrong with the script

I’m guessing your $and should be a $or, or you might be getting tripped up by the spaces in your $if2 functions. In addition, your brackets are mismatched. Personally, I would have written it as:

    $eq(%albumartist%,Various Artists)),
    $set(albumartist, $if2(%compiler%,%djmixer%,%label%,Unknown))
    $set(albumartistsort, $if2(%compiler%,%djmixer%,%label%,Unknown)))

This looks for a match on the “Various Artists” ID and the albumartist being “Various Artists” – only triggering if both conditions are met. Checking for both conditions addresses the potential problem in cases where the albumartist is credited to something other than “Various Artists”. That condition could also be addressed by checking the “Use standardized artist names” box under Options -> Metadata.

It also adds a default “Unknown” if all of the %compiler%, %djmixer% and %label% tags are empty. has two DJ-mixers credited to the release, which means `%djmixer% is likely a multi-value tag and I’m not sure if Picard automatically translates those into a nice string, so you may have to do something to make sure the variables you use are always added as strings. should fall back to use %label%… Are you sure %label% is the right variable to use? Maybe %label% is always treated as a multi-value field and need the same treatment as above?

Just tried the script I offered above in Picard with the two examples you listed. In the first case, both the “Album Artist” and “Album Artist Sort Order” entries show as “Circus Records; UKF Music”. Note that both parts of the multi-value field are shown separated by a semi-colon. In the second example, the “Album Artist” and “Album Artist Sort Order” entries are both set to “Rounder”, as expected. I am assuming (which can be dangerous) that a multi-value field there would be presented the same way as in your first example.

Thanks rdswift and Freso, that looks like it works well enough for me!

Ironically, one of the first albums I tried it with was - which literally has “Various Artists” printed on the cover :stuck_out_tongue: I guess I’d better be a bit careful with this new found power :smiley:

Hrm, the Doctor P/Flux Pavilion release ( actually does already include “compiler” tags, but they don’t come across into Picard for some reason? Seems odd that the record variable is available but the compiler one is not…