Topic: Compilation flag from Plugin

Is there any way from a plugin that I can see if a release is a compilation or not? I was expecting to be able to use metadata["compilation"] or similar, but this doesn't seem to be set.

At the moment I have a convoluted function which parses the release info and checks the percentage of tracks that have the album artist set as a contributing artist for that track. If that percentage is below a certain threshold (I think I'm using 70% at the moment) then the release is considered to be a compilation. However if there's a more reliable way of doing this via the info scraped from MusicBrainz, I'd definitely prefer it over my method.

Re: Compilation flag from Plugin

There is an option built into Picard to set the compilation tag, but it just depends on whether 100% of the tracks are set to the release artist I think, so it's probably not a very useful one at the moment.

Re: Compilation flag from Plugin

Yes, and it's calculated after plugins are run so it's not accessible to them. It's set in time for tagger script though, but IIRC there are some issues here; I don't think it's recalculated if the tagger script ends up changing artists (although this isn't a common use case, and I think you could always force it off if you wanted)

The logic is basically:

artists = set()
for medium in release:
    for track in medium:
        artists.add(track.metadata["musicbrainz_artistid"])
for track in release:
    if len(artists) > 1:
        track.metadata["compilation"] = 1

On a related note, there have been numerous requests to change how this is calculated now, due to changes in the way iTunes interprets the flag in more recent versions: http://tickets.musicbrainz.org/browse/PICARD-199

Would be good to get more votes/thoughts/feedback about this so we can evaluate whether to change it now.