Split country GB, GBGB, GBGBGB to GB, GB;GB, GB;GB;GB

Hi,

The MusicBrainz expanded plugin gives for the field COUNTRY 2 digit country code.

But for some albums it create multiple countries.

For example :

A Retrospective of House 91'-95', Volume One gives GBGBGB

What is the regular expression to separate the 2 digit country code to:

GB;GB;GB

Thnx

To treat consecutive upper case letters, try
Regular expression: (\u\u)(\u\u)
Replace matches with: $1;$2

you could apply a filter like
%field% MATCHES "\u\u\u\u"
and toggle the filter until you do not get any more hits.

thank you for your time

I made the regular expression in an action group.

It split only the first GB (GB;GBGB)

After consideration I “want” something more complicated.

It will be possible the plugin creates : GBDESE (United Kingdom, Germany, Sweden)

Also I go 1 step further and create a double: GBDESESE (United Kingdom, Germany, Sweden, Sweden)

So what I really after is:

split GB;DE;SE;SE and after that remove the doubles so the end result would be:

GBDESESE ==> GB;DE;SE

I don’t understand nothing from regex, for me this is chinese :stuck_out_tongue:

I tried to make clear that you have to execute the action a couple of times.
As I said: it splits 4 consecutive capital letters into 2 pairs.
So if you have GB;GBGB, then you simply have to run the action again to get GB;GB;GB.
And if there are 4 douplettes, you have to run it 3 times.

To remove duplicates, it would mean to first sort the list and then apply an even more complicated regular expression like e.g. from this thread:

thank you again, I didn’t understand the last part whit the filter in the first post…

I will follow the link you provided

thnx

You can apply the action a couple of times to the same files. If no match is found, the original data is kept.
That would probably be faster than doing it manually.

This is crazy stuff….

What i did:

create in an existing action or new created action:

-Select new, select “replace with regular expression” with setting from ohrenkino

Regular expression: (\u\u)(\u\u)
Replace matches with: $1;$2

-duplicated that 9 times (I know overkill :stuck_out_tongue: )

-then select new, select “format vallue”

Field : COUNTRY

Format string: $trim($regexp(%COUNTRY%,'(?:(?<=;)|(?<=\A))\s*([^;])\s;(?=.?(?<=;)\s\1(?=;|\Z))',,1))

Result : FRDEESGESESESE ==> FR;DE;ES;GE;SE

Big Up

Thnx and greetings from Belgium

Just an idea:
If instead of

Replace matches with: $1\\$2
got used, then this would create a number of multi-value fields.
These could then be reduced with an action of the type "Remove duplicate fields" and the option ticked to remove only those with identical contents.
Finally, an action of the type "Merge duplicate fields" would create a nice cleaned-up list.

Hi,

musibee uses ; as separetor, so I start and will endup with ;.

In mp3tag I make in a custom tag P033 where the GBGBGBSE end up.

In my action:

I use your regular expresion

GBGBGBSE ==> GB;GB;GB;SE

Then I split the end result up in separated tags p033a, p033b,… 1 for each country.

Here end my action.

I work then in musicbrainz who I force to look up the tracks as singles, ep or album level.

When track and or artist is not the same in mp3tag and musicbrainz search results, it stops the script and i get a warning flag, those tracks i must do manual. (10-20 tracks from 800)

(this part is not 100% waterproof (and will never be I think) at the moment.

From 800 test tracks there are 2-3 tracks that will end up with wrong data)

It will create a tag if it the album is a single, maxi, album, best-of, compilation or is a dj-mix (mp3tag data) and set my albumartist tag if is not an compilation.

If title and artist are equal in search results from musicbrainz ==>

it looks for a country (b033a,bo33b,…) but other releases = more chance to retrieve a country and other tags and is also more in function for tracks on compilations.

Also I convert the 2-digit landcodes from all tags to the full name and combine all those in tag country field.

I get something like:

United Kingdom;United Kingdom;United Kingdom;Sweden;Unite Kingdom

When United Kingdom appears, I try to retrieve Ireland and Scotland if possible. (need area tags for that)

When found, I replace United Kingdom.

After this I run MP3tag again and in my final action I cleanup all my tags.

With the link you provide I keep only the unique values in the Country field and end up

with: United Kingdom;Sweden

After that I delete the p033,p033a, p033b,… b033,b033a,bo33b,… tags

remove blank spaces, capital use, format track/disc numbers and the filenames….

That is one part of my scripts in mp3tag and musicbrainz (and is working now)

The other parts i must write where I hunt tags for:

-dates in other tags (is almost working)

-look further for countries in other tags

-languages (is almost working)

-if the track is a cover, remix, album version, 12”, 7”, acoustic or is a live performance, soundtrack…

Those individual data can be found at 5-6 or more different fields…..

When everything is running I will post the setup/scripts/source script from mp3tag and musicbrainz

:stuck_out_tongue:

This is now fixed with v2.31 of the MusicBrainz expanded WSS.

As in most other fields with multiple values, I have used the slash / as separator.
Feel free to replace this separator character with one that you prefer.
Just change Line #708 in the new v2.31 file MusicBrainz expanded.inc from
say "/"
to - for example
say ";"
to directly get GB;GB;GB instead of GB/GB/GB from the new v2.31 WebSourceScript.

This allows you to skip the above regular expression and additional Action.