Store multiple album interpreters in a meaningful way

Hi@all,

I have been using MusicBrainz Picard for a while, but I am not a professional. I have dealt with the configuration before use because this is not unimportant :slight_smile:

Now I would like to refine my setup. I first describe my problem with an example. I have albums from B.B. King. Logically, the album artist in the ID3 tag is “B. B. King”. Now I have another album that has “B.B. King & Eric Clapton” in the album artist. In my Mediaserver (Jellyfin) I can display all album artists of my collection. Here these two are listed as separate album artists.

Personally, I would prefer both to be listed as “B. B. King”. I am not an ID3 professional. Are there other fields in which I can write the additional information (additional album artist)?

It would be nice if I could do this via the script function of MusivBrainz Picard :slight_smile:

with best
pixel24

A lot of what you want to know can be found in Picard’s very comprehensive documentation.

The tag names you see in Picard are mapped internally to ID3 tags (which have 4 character names) - the tag mappings can be found here. This page also defines the internal name which you use with “%” symbols on either side as a script variable.

In some tagging formats, some variables are not mapped to tags, but for ID3 all variables are mapped to tags including any you create yourself - except for variables beginning with a “_” that hidden i.e. not shown in the main tag list (but you can see them using a plugin I wrote many years ago called “View script variables”).

(And if you cannot find a way to do what you want using scripts but have some python programming skills, then you can often find a way to achieve it by writing a plugin.)

Artist names are stored in several variables - and these are usually also used in file naming scripts to define the path and filename for music files - and all of these can be modified if you wish using scripts.

So there are variables/ID3 tags for both track and album artist(s), and these come in various flavours - for both album and track artists you get a string (so multiple artists are simply part of this string) and a “sort” string (which moves words like “The” and “An” to the end of the string so that “The Beatles” can be filed under “Beatles, The”), and tracks also have multi-value variables containing artists as individual values (so that you can access them individually without e.g. guessing whether a ", " or a " & " are characters joining artists or characters actually in the artists name).

(Note: As an aside, I have no idea why we still don’t have multi-value variables for album artists or “sort” versions of these multi-value variables.)

So one way you can achieve what you want would be to do something like:

$set(artist,$getmulti(%artists%,0))
$set(artistsort,$swapprefix($getmulti(%artists%,0))

Alternatively you can use @rdswift Bob Swift’s Additional Artists Variables plugin and copy the hidden variables you want onto the artist/album artist variables.

Good luck!!

1 Like

I have read the documentation. However, I am still a bit overwhelmed with the scripts :frowning:
I try to approach step by step.

Ok, understood so far. I want to rewrite the albumartist. This is the internal variable: %albumartist% which in my case (I have only OGG Vorbis files) is mapped to the tag ALBUMARTIST.

ok, as I said I use OGG Vorbis files with ID3v2 in version 2.4 (UTF-8) all tags are mapped. In addition, there are hidden tags that start with a prefixed “_” and are not visible by default. You have developed a plugin that makes them visible.

Since I want to rewrite the %albumartist% as I said, I do not need hidden tags, right?

So I rewrite the %albumartist% in the tag script and this then also affects the folder name (is = albumartist for me)?

I saw that and also understood “Beatles, The” so that they are also sorted under “B” and not “T”.

I can see that in the example of “B. B. King & Eric Capton” in the “Artist” tag here:

dcb03ce3-67a5-4eb3-b2d1-2a12d93a38f3    ->  B.B. King
618b6900-0618-4f1e-b835-bccb17f84294    ->  Eric Clapton

So I understand:

$getmulti(%artists%,0)

Returns the index 0, i.e. the first entry in the array/dictonary … So in my example “Eric Clapton” ?

So it would be on my example:

$set(albumartist,$getmulti(%artists%,0))
$set(albumartistsort,$swapprefix($getmulti(%artists%,0)))

I contribute: Options → Scripting?

I tested it with a copy of the album “B.B. King & Eric Clapton”. The album artist would now be correctly named “B. B. King”. Under Artists both artists are still included. That is already good.

However, this script leads to problems with samplers (albumartist=Various Artists). He would like to remove this now:

I have looked at the if condition in the handbook. But it is unclear to me how I formulate the condition that the:

$set(albumartist,$getmulti(%artists%,0))
$set(albumartistsort,$swapprefix($getmulti(%artists%,0)))

will only be executed if albumartist is NOT “Various Artists”. Or simpler if the %artists% tag does not exist. This is not the case with Various Artists. At least I think so.

I have tried so what unfortunately does not work:

$if(%artists%,$set(albumartist,$getmulti(%artists%,0)))
$if(%artists%,$set(albumartistsort,$swapprefix($getmulti(%artists%,0))))

I think I am closer to the solution. I’m still struggling with the syntax :frowning:

$set(various,$startswith(%albumartist%,Various))
$if($not(%various%),$set(albumartist,$getmulti(%artists%,0)))
$if($not(%various%),$set(albumartistsort,$swapprefix($getmulti(%artists%,0))))

It would likely be easier to make the check on the artist tag once, and include all actions in the single $if() statement. I would also check for the MBID of “Various Artists” rather than the name because this could be different (the name to use can be changed in Picard’s configuration settings). Perhaps something like:

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $noop( Do nothing on a match. ),
    $noop( No match.  Do renaming. )
        $set(albumartist,$getmulti(%artists%,0))
        $set(albumartistsort,$swapprefix(%albumartist%))
)

Note that this could set the %albumartist% and %albumartistsort% tags to different values for different tracks in the same album if the track artists are different. This is because the script will be executed separately for each track. I don’t recall if this is what you wanted to happen, so I thought I better mention it.

1 Like

With this it looks good :slight_smile: For albums that have multiple artists in %artists% the first one is set as %albumartist%. With the samplers (Various Artists) this does not happen.

For albums with only one albumartist everything remains unchanged. This is also how it should be.

Is it possible that exactly in this case (artists contains multiple entries) also the filename is changed to the first one? In this case B. B. King?

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $noop( Do nothing on a match. ),
    $noop( No match.  Do renaming. )
        $set(albumartist,$getmulti(%artists%,0))
        $set(albumartistsort,$swapprefix(%albumartist%))
        $set(artist,%albumartist%)
)

I have added a corresponding line. Seems to work. I can only not really estimate whether it is so correct

Yes, but that is handled in your file naming script, and you need to enable the “Move files when saving” and “Rename files when saving” options in the File naming option settings. See the File Naming Script Editor section for more information. There is also a tutorial on how to write a file naming script, that you might find useful. When writing / revising your file naming script, note that any changes to the tag / variable values made in yout tagging scripts will be the values used in the file naming script. In other words, the %albumartist% tag will be the single artist as updated in your earlier tagging script.

If you run into problems, you can post your file naming script here and we can try to help.

1 Like

I would actually suggest that you modify your file naming script to use the (updated) %albumartist% value rather than the %artist% value in the appropriate spots instead, because what you are doing will change the value of the %artist% tag in the metadata to only the first artrist in the list. I don’t think this is what you want.

I hope I understand them correctly. Yes, if it is the album artists:

  • B. B. King
  • Eric Clapton
  • Whatever

there should be the file:

B. B. King - [Trackname].

That would be correct then, wouldn’t it?

I’m testing it right now with different folders. What I noticed:

If I deactivate the script, the correct album artist is displayed on the “Album” level. See:

If I now activate the script it looks like this:

On the “level” of the tracks, the album artist is correct. On the “level” album it has now disappeared.

I have inserted the script as you suggested:

Now I have an album here that has the correct value in the album interpreter (10cc). But some tracks are from other artists. The script now wants to change these. See:

It shouldn’t be that way. I think I have to solve this problem first before I go to the filename, right?

So what would you expect to see? The first artist (10cc), the last artist (Hotlegs) or something else?

As I mentioned earlier, each track is handled separately from the others, and you can’t share information between tracks. This is also noted in the Tagging Scripts section of the documentation. There is a way around this using the “Persistent Variables” plugin, but it would require some changes to your scripts.

You are right, it is logical. I thought it could be implemented that %albumartist% either:

  • The first one is the one found if %artists% exists.
  • If it does not exist we use already set %albumartist%.

I had tried it like this:

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
	$noop( Do nothing on a match. ),
	$noop( No match.  Do renaming. )
		$set(albumartist,$if2($getmulti(%artists%,0),%albumartist%))
		$set(albumartistsort,$swapprefix($if2($getmulti(%artists%,0),%albumartist%)))
)

which unfortunately does not lead to the desired behavior :frowning:

Perhaps the solution is a bit simpler. Does the following tagger script do what you want?

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $noop( Do nothing on a match. ),
    $noop( No match.  Do renaming. )
        $set(albumartist,$getmulti(%_albumartists%,0))
        $set(albumartistsort,$swapprefix(%albumartist%))
)
1 Like

It looks good like this! Thank you for your patience!

If there are to be multiple albumartis gib:

  • The artist directory should be found equal to the first one
  • In the files also only the first one found should be used

My script for the files:

%albumartist%/
%album%/
%artist% - %title%

I have enabled renaming files on save. So I still need to enable the “Move”. This must be in new path, right?

I have to adjust the %artist% - … in the filescript accordingly. That would be the same code as in the tag script, right?

No problem. I should have noticed that sooner.

Right.

I’m not sure I understand what you want there. Do you want all of the track titles to have the same artist name (the first album artist) or do you want them to have the actual artist name for the track? If the former, simply change %artist% in the file naming script to %albumartist%. If the latter, you don’t need to change anything.

I wanted it that way:

If there are several %albumartists% the first one should be used as %albumartist% and also for the filename. But the tag for the artist should be kept.

But for “Various Artists” the actual artist should be used as filename and not Various Artists.

I hope I could explain it understandable.

I just gave it a try:

%albumartist%/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)

Have now tried only two but could work