Keeping only primary album artist

I’ve been using the following tagger script to keep only the primary album artist:

$set(albumartist,%_artists_album_primary_std%)
$set(albumartistsort,%_artists_album_primary_sort%)

This seems to work most of the time, but when I get to Cyrillic and try to tag Sergei rachmaninoff for example, it sets the album artist sort tag correctly (Rachmaninoff, Sergei) but still uses the Cyrillic spelling for the album artist tag (Сергей Рахманинов).
_artists_album_primary_std and _artists_album_primary_sort are from the additional artists variables plugin.
Why might this be happening? Is there a better way to achieve the desired reusult?

The _artists_album_primary_std variable uses the standardized artist name, and that is Сергей Рахманинов on MB. You can use _artists_album_primary_cred to get the artist as credited.

You can also try to enable artist name translation in Options > Metadata. Not sure how the plugin works in combination with the translation. Maybe using _artists_album_primary_legal then.

1 Like

I see, is there another way to only keep the primary album artist? Something like cutting the rest out, because without the tagger script the name is correct.

I did try cred and legal earlier but they are not standardized :confused:

@rdswift is the expert here :slight_smile: Let’s what he can say about it.

1 Like

Ok! One other idea I have is to “unsort”_artists_album_primary_sort since that always seems to be the english standardized version of the name (Rachmaninoff, Sergei). I just havent found a way to unsort.

It’s been quite a while since I wrote that plugin, but if I recall correctly it parses out the standard and credited names from the information returned in the original call to MusicBrainz for the release. For sure there is no option to translate names to other languages. Perhaps when I get a few minutes I can see if it can be modified to work with the “Translate artist names to these locales when possible” setting in Picard’s Metadata options.

1 Like

For simple names (with only one comma) you could do it with a tagger script like:

$if($rsearch(%_artists_album_primary_sort%,\(^[^\,]+\,[^\,]+\$\)),
  $set(_split1,$trim($rsearch(%_artists_album_primary_sort%,^\([^\,]*\))))
  $set(_split2,$trim($rsearch(%_artists_album_primary_sort%,\,\\s*\([^\,]*\)\$)))
  $set(_new_primary_album_artist,%_split2% %_split1%)
,
  $set(_new_primary_album_artist,%_artists_album_primary_sort%)
)

This will set a new variable %_new_primary_album_artist% based on unsorting the %_artists_album_primary_sort% variable. If you also need it to work with sort names with multiple commas such as “The Alan Parsons Project” which has a sort name of “Parsons, Alan, Project, The” we’ll need to make some modifications to the script.

3 Likes

Thank you, this works beautifully!

But surely there must be a more direct way to get the primary album artist? Like you say, this will not always work.

For instance, where does %_artists_album_primary_sort% get the unsorted value from? Could that be used directly, perhaps?

Or could a tagger script count the individual “parts” of %_artists_album_primary_sort%, compare them to the parts in %albumartist% and remove any that don’t match, going right to left, until the remaining parts equal the number of parts in %_artists_album_primary_sort%? And also simply copy the string to %albumartist% if %_artists_album_primary_sort% contains no sort delimiters.
I feel like that would be pretty reliable, but I’m probably missing something.

As mentioned earlier, all variables are taken from the information provided by the result of the original call to MusicBrainz for the release information. All the plugin does is expose them as variables for use in scripts. It doesn’t create the sorted variables. Those also come from MusicBrainz.

I’m not sure I follow what you’re suggesting.

What I think you’re really looking for is the English locale version of the standardized artist name (if one happens to exist and is different from the standardized artist name). I’ll have to see if that information is returned by MusicBrainz in response to the original release query, and consider providing it based on the “Translate artist names to these locales when possible” Metadata option setting in Picard.

Yes, I need %albumartist% to be set to the English locale version of the standardized primary album artist name. That is what I thought %_artists_album_primary_std% did in my original script. It would be great if the plugin or picard could grab that value directly instead.

I also realised that %_artists_album_primary_sort% doesn’t return the value I need in some cases. It provided “Scriabin, Alexander Nikolayevich” when I need “Scriabin, Alexander”, for example.

So yes, a plugin variable or something in Picard to always get it would be much appreciated!