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. https://beta.musicbrainz.org/release/4d17448a-d73a-3669-830b-3b9741be0eef, but it isn’t working for either https://beta.musicbrainz.org/release/2255f75e-24c4-4a04-9e43-805ed12e1b6d or https://beta.musicbrainz.org/release/20815da0-b99f-448b-9ea2-3ac2476737fe, 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:

$if($and($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $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.

https://musicbrainz.org/release/2255f75e-24c4-4a04-9e43-805ed12e1b6d 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.

https://musicbrainz.org/release/20815da0-b99f-448b-9ea2-3ac2476737fe 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 https://beta.musicbrainz.org/release/2a0736a4-411c-4673-82da-55cc597a7122 - 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 (https://musicbrainz.org/release/2255f75e-24c4-4a04-9e43-805ed12e1b6d) 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…