Why doesnt this $replace( work?

Hi,

Im struggling again trying to replace all instances of Snoop Doggy Dogg with just Snoop Dogg

Tried all sorts of variations of
$replace($or(%artist%,%artists%,%albumartist%),Snoop Doggy Dogg,Snoop Dogg)
But none work!!!
What am i doing wrong?

FYI Snoop Doggy Dogg can appear as a second (featured) artist in a multi-value field (with a : seperating it to the previous/next value)

Your advice as always is appreciated

anyone help with this one? im beating my head against a wall

It’s not quite clear if you use this in the filenaming script or in Options > Scripting. Depending on where you use this it does different things.

In filenaming script it will write the artist if it set, else the artists if it is set and lastly albumartist with Snoop Doggy Dogg replaced by Snoop Dogg.

In Options > Scripting it will do effectively nothing, because no tag is being assigned a new value.

I’m not fully sure of your goals, but assuming you want to replace the name in all three tags (artist, artists, albumartist) you will need to use the following script:

$set(artist,$replace(%artist%,Snoop Doggy Dogg,Snoop Dogg))
$setmulti(artists,$replace(%artists%,Snoop Doggy Dogg,Snoop Dogg))
$set(albumartist,$replace(%albumartist%,Snoop Doggy Dogg,Snoop Dogg))

Note the usage of $setmulti for artists. Because this is a tag with multiple values you need to use $setmulti, otherwise it would get converted to a single value tag.

4 Likes

My apologies i was attempting to replace the term through the Options->Scripting menu
For this, your code $setmulti(artists,$replace(%artists%,Snoop Doggy Dogg,Snoop Dogg)) worked a charm. Now that i have the syntax to use i can modify for different terms/tags as these come along

Thankyou very much

EDIT

I forgot to ask, If i come across the “Snoop Doggy Dogg” within the title tag how can i find/replace this term?

Basically the same as above with the artist tag:

$set(title,$replace(%title%,Snoop Doggy Dogg,Snoop Dogg))
4 Likes

Perfect! thankyou @outsidecontext