Handling of multiple release countries with Picard 2.3.1

Recently there has been quite some debate about some digital releases with a really long list of release countries added. Independent on your stand on this matter, this has shown that there are some issues with how these releases are handled by Picard. Hence the current Picard 2.3.1 release attempts to make some improvements.

Let’s take the following release as an example.

By default Picard will write a single releasecountry tag to the files. So far Picard has been populating the tag with what the MusicBrainz server returns as the country for the release. If there are multiple release events this country field is just filled with the first one in alphabetical order (Algeria in the example). But Picard 2.3.1 offers you some options to handle it better.

Using preferred release countries

The first improvement is automatic if you have configured preferred release countries in Options > Metadata > Preferred Releases. Picard will use the first country from the preferred release countries that is also in the list of release events. So for example I have configured preferred release countries to be Europe, Germany, UK. For the above example that would mean releasecountry gets set to Germany.

Using scripting to set a different country

Picard 2.3.1 provides a new variable %_releasecountries%, which provides the complete list of release countries for a release. You can use this to set different values for releasecountry.

For example the following script would set it to “[International]” if there are 10 release countries or more:

$if($gte($lenmulti(%_releasecountries%),10),$set(releasecountry,[International]))

Of course you can adjust the count and the replacement text to your liking. You can also choose to save the entire list instead of just a single country to this tag:

$setmulti(releasecountry,%_releasecountries%)

Or maybe limit this list to the first entries. The following example just uses the first 6 countries:

$setmulti(releasecountry,$slice(%_releasecountries%,0,6))

What’s missing?

Countries are currently written to the tags as their ISO 3166-1 country code, with some special values added for historical countries and things like [Europe] or [Worldwide]. These codes are not always easily recognizable, e.g. that DZ is Algeria or DE is Germany might not be obvious to you. You can of course use scripting to make this more redable, e.g. if you want to see “United Kingdom” instead of “GB” in this tag use:

$if($eq(%releasecountry%,GB),$set(releasecountry,United Kingdom))

This might work if you deal only with a couple of countries in your collection. Or you just want to handle some special cases like using “Europe” instead of “XE”, e.g. I use the following script:

$if($eq(%releasecountry%,XE),$set(releasecountry,Europe))
$if($eq(%releasecountry%,XU),$set(releasecountry,[Unknown]))
$if($eq(%releasecountry%,XW),$set(releasecountry,[Worldwide]))
$if($eq(%releasecountry%,XG),$set(releasecountry,DDR))

But I actually would like to see some helper functions for this, e.g. there could be a $countryname() function one can use to easily convert the code into a readable name.

UPDATE: Since Picard 2.7 you can also use the $countryname function to get the proper country name from the code:

$set(releasecountry,$countryname(%releasecountry%))
9 Likes

I could try to come up with something similar to the $language_name plugin that I wrote to return language information. There is a User Guide for the plugin, and the plugin and source code are available for download on GitHub. This could also provide a starting point if anyone else wanted to try developing something.

2 Likes

This needs a louder WOO! YAY! and Thanks! :partying_face: :partying_face: :partying_face:

I hadn’t even spotted the confused countries before, but realise I have many albums over the years that are therefore missing “correct” country info due to the one country limit.

Excellent job on a neat solution there.

2 Likes

Exactly same situation for myself actually, except that I think for my previously tagged files it was never a big issue. Most probably had one country set, or maybe there were two or three, mostly probably listing UK or Germany.

But now with the band camp and other digital releases it has become annoying. I was very happy when I realized this can be improved with rather simple changes :slight_smile:

4 Likes

A year later I add as second Thanks for this little script. Kinda got distracted this time last year with some drama or other and didn’t get this into place. Only change I have made it use the word [Worldwide] in the main statement. Or is [International] some specific standard?

1 Like

I used “[International]” just as an example, also to avoid clever comments about that it is not really worldwide if [small country of your choice] is not included :smiley:

Also because you mentioned that now it’s no longer Afghanistan being listed as the release country all the time: What really helped me personally here is setting the preferred release countries in Options > Metadata > Preferred Releases. As Picard will prefer picking the first matching country from this list for the release country tag it usually works out well for me. If I set this to something like Germany, GB, Europe, France, US I cover the majority of what my collection consists of, with only a few outliers. It also helps me a lot with having Picard pick the right release for me.

2 Likes

I’ve never really used the Release Countries list as I do have a number of multi-language releases. And there is the randomness of UK releases being marked as Europe due to Dutch or German manufacture. I’m more likely to go hunting for exact release matches. I will now try your suggestion if it pushes GB up the digital list.

Oh, and Afghanistan is still top of the list. But shouldn’t Aland islands be listed with the “A’s” and not at the bottom?

1 Like

Thanks to @rdswift this is now part of the official Picard documentation and will be kept up-to-date there:

http://picard-docs.musicbrainz.org/en/tutorials/multiple_release_countries.html