Help with tagging script - $substr?

I’m using the Additional Artists Details plugin, and have the following script to collect origin countries for artists:

$set(_tmp,_artist_$getmulti(%musicbrainz_albumartistid%,0)_)
$set(ARTISTCOUNTRY,$if2($get(%_tmp%location),$get(%_tmp%begin_country),$get(%_tmp%end_country),xx))

90%+ of the time it gives me exactly what I want (“United Kingdom”, “France”, etc), but sometimes it returns something like “New York, United States”, or even “Edinburgh, Scotland, United Kingdom”.

Is there a way to adjust my script so that it only returns the last part, after the final comma? I tried using $substr but I couldn’t get it to work.

Thank you!

I haven’t touched this script in so long that I can’t really remember how it all hangs together, but this just gives the country shortcode:

$set(_tmp,_artist_$getmulti(%musicbrainz_albumartistid%,0)_)

$set(artist country,$if2($get(%_tmp%country),$get(%_tmp%begin_country),$get(%_tmp%end_country),xx))

Seems to be fetching %_tmp%country instead of %_tmp%location in yours

1 Like

Thanks, aerozol.

I seem to remember country codes not being recognised by my player which is why I had the full country name, but I’ve just tried again and I think it’s working with the codes now.

1 Like