Extract artist family name

Tags: #<Tag:0x00007f00bf462d70>

Any ideas how to extract the family name form %artistsort%, so that “Mozart, Wolgang Amadeus” gives me only “Mozart”?

Thanks!

You could use something like the following script:

$set(familyname,$rsearch(%artistsort%,\(.*?\)\,))

This will take everything before the first comma and set it as a new tag familyname. Of course using familyname here is just an example as I don’t know what you want to do with the family name. You could as well directly replace the artist name with that:

$set(artist,$rsearch(%artistsort%,\(.*?\)\,))

This will work well for sortnames that are for persons with typical European “Family name, first names” sort order. But if the artist sort name does not follow this pattern, or if it is not a person name but still contains a comma, or if there are multiple artists this approach would fail. But maybe it is sufficient for your use cases.

1 Like