Replace feat. with ; (semicolon)

I’m sorting through all my music and using Musicbee and Plex as the primary playback devices. Musicbee separates multiple inputs with ; (semicolon) so I can search for every song an artist is part of, even as guest appearances on other albums. Leaving the feat. in the artist field creates a third artist, for example, Apocalyptica, Corey Taylor, Apocalyptica feat. Corey Taylor.

I tried doing a basic replace command to swap feat. with ; (semicolon),
$set(artist,$rreplace(%artist%,feat.,; ))
but that results in something like Apocalyptica ; Corey Taylor instead of Apocalyptica; Corey Taylor.
Basically it leaves in some funky spacing I don’t know how to get rid of. Is there any way I can get rid of the funky spacing?

Edit, the forum apparently autoresolves double spaces to a single space. The result from the replace command is artist ;(double space)artist2

1 Like

Howdy! I also use MusicBee. I’ve written a script that will (provided things are entered correctly in the database) tag feat artists, remixers, etc to appear as multiple artists in MusicBee, and also insert the Display Artist field that MusicBee uses. (Note this also relies on the Standardize Feat. plugin.)

This is my script:

$if($in(%artists%,;),
	$set(DISPLAY ARTIST,%artist%)
	$if($in(%artist%,feat.),
		$set(artist,$rreplace(%artist%,\\sfeat.*,))
    		$setmulti(GUEST ARTIST,$replace(%artists%,%artist%; ,))
		,
		$copy(artist,artists)
	)
,)

$if($in(%title%,mix by ),
	$if($not(%remixer%),
		$set(remixer,$rreplace(%title%,.*mix by ,))
		$set(remixer,$replace(%remixer%,\),))
	,)
,)
1 Like

To answer the general question about why you’re getting extra spaces: It’s because you need to account for them in the $rreplace statement. There’s a space in front of feat. and a space after it and you’re leaving both of them in, then adding a new space after the semicolon.

It needs to be:

$rreplace(%artist%, feat.,;)

This will replace the space in front of feat. and leave a space after the semicolon without adding an extra one.

5 Likes

It also occurred to me, after looking over my own script, that you might be happy just doing this part:

$copy(artist,artists)

That should give you the list of artists without any join words, just the semicolons.

2 Likes

This seems to be simple enough to work, thanks. Didn’t really think about the replace command replacing spaces.

Pretty sure I’ve seen you. Aren’t you a super user over on those forums?

How are you using all those artist tags? Seems really confusing to me. It adds in the display artist and guest artist which are only for Musicbee right?

It also removes the featured artist from the artist field, which is the exact thing I was asking for.

I’m a mod on the forum there, which mostly means I delete a lot of spam, lol.

“artist” and “artists” are different things in Picard, the latter being the semicolon-separated list (so it already contains the result you’re looking for). My script puts “artist” (the artist credit with join phrases) in Display Artist, then uses “artists” to assign the main artist to Artist and the feat. artist(s) to Guest Artist, which MusicBee treats as part of the main artist list (along with Remixer and all Performers). So with MusicBee’s functionality you’ll still see them all in the same list. That probably won’t be the case in other players, though.

And you are MMMM.

(Most Modest Member of the Month)

2 Likes

Woof. Still seems complicated. I’ll just stick with the default and go with artist; artist.

1 Like

Of course. You make it do what you need, I just offered mine as an example.