Count which composer has the most tracks with tagger script

Tags: #<Tag:0x00007f4d584d7e78>

I know I’ve seen this somewhere but I can’t figure out where so I have to ask. I’m trying to use the composer in a file naming script but this won’t work when an album contains more than one composer seeing as I’d like to keep all files from an album in one single folder, and I’m using the album artist tag for other purposes so that’s not a workaround.

Is there any way to count which composer has the most tracks on a given album and then write that name to a temp tag to be used in the file naming script?

In the Classical Extras plugin, the hidden variable ~cea_album_composers (and also ~cea_album_composer_lastnames and ~cea_album_composers_sort) contains all the composers who are listed as release artists, in the order of total length of their related tracks. So if you pick the first-listed composer from this variable, it should be the one with the greatest amount of music on the album (not the greatest number of tracks).
EDIT: In tagger script, replace that tilde at the start with an underscore.


Appreciate the reply and the plugin. I suspect I’m doing something wrong but for me, that variable is not returning multiple values for the whole album but instead a single value for every individual track. I don’t understand how I’m supposed to pick the first-listed as they’re all first-listed as there’s only one composer per track.

It basically returns the same value as composersort would.

Can you provide a link to the release in MB and I’ll look into it.

Feel free to do that, but I’m not very good at this so I’m still convinced it’s a user error.


returns “Chopin, Fryderyk” for the first 26 tracks and “Schumann, Robert” for the last track. This release:

This one doesn’t return anything at all:

I used the $set in the tagger script just as a test to see what it would do. I tried using the hidden variable in the naming script too but it produced the same result as before, splitting the album up into different folders.

Hi MetaTunes, may I suggest a new feature for your excellent plugin ?

It could be very interesting for those like me who use KODI as media player, to have for each hidden variable referred to artists the corresponding artist_MBID.

I’m suggesting this because the scraping algorithm of KODI to collect artist informations on Musicbrainz DB is based on MBIDs stored on musicbrainz_artistID and musicbrainz_releaseID (where the MBIDs must also be exactly in the same sequence of the artists in the Artists/Albumartists tag, or in the Artist/Albumartist tag if the former are missed).

Many thanks

OK - two slightly different issues.

  1. Re the Chopin/Schumann: It seems that the plugin is only properly populating _cea_album_composer_lastnames in the manner I described, not the other two tags. I’ll look into that.
  2. Re Clair de Lune, there is no composer in the release artists list, so none will be listed as an album composer by the plugin.

Interesting idea. I’ll look into adding that in the next release.

Thanks a lot for taking a look at it! I suppose the Clair de Lune one won’t be the only time I run into this issue and there’s really no way to script around that. I realized I was getting some form of automatisation tunnel vision and that I could fairly easily just input an album composer manually and use that in the naming script so I’ll probably resort to that.

But you can edit the MB release, if you consider that the composers should be named as release artists under the classical music style guidelines.