Regex help in scripting

I’m trying to set my “artist” tag to be the first artist in the “artists” list. I figured out how to do this for single artist albums by using the “Album Artist” tag, but am having trouble with “Various Artist” albums.

Here’s my latest line, I’ve been trying to make sense of the regex, but after several hours of experimentation, I’m failing. The closest I’ve been is getting “;”. I started from this in another thread;

My latest iteration is this, after going back to the beginning again;
$set(artist,$rsearch(%artists%, [^\)]+;,)
And I get Everything after the first space in the %artists% variable.

I’d appreciate some assistance.

I think what you want is:

$set(artist,$rreplace($if2(%artists%,%artist%,%albumartist%),;.*\$,))

I tested this here by entering it as a script in the Options → Scripting section and it seems to do what you’re looking for.

1 Like

I appreciate the string; and your plugin, by the way.

Curious about your thoughts on optimization. Am I better off using your plugin to get the primary Album Artist, or a line in the script similar to this to pull only the first artist in the list? Not expecting huge differences, but when you multiply a second per album by thousands of albums, you start talking about minutes fairly quickly.

1 Like

The plugin (AlbumArtist Extension) was developed mainly to deal with providing both standardized and credited album artists, and the primary album artist tag was an afterthought. This is because both standardized and credited were not (consistently) available at the same time in the default tags provided. As written, the plugin simply exposes information already available and does not make any calls to the database, so there should be no significant additional overhead.

1 Like