Need help with scripting

Hi, I encountered an issue dealing with multi-value “artists” tag. I"d like to replace one (or multiple) values inside of the tag, but I wasn’t able to figure out how.

This is one of the multi-value artists tags that I am dealing with, using ; as the separator:

“Armin Van Buuren; Sharon Den Adel”

I’d like to replace the tag into following:

“Armin van Buuren; Sharon den Adel”

So far I have tried $set and $setmulti variables, such as the following:

$set(artists,$replace(%artists%,Armin Van Buuren,Armin van Buuren))
$set(artists,$replace(%artists%,Sharon Den Adel,Sharon den Adel))


$setmulti(artists,$replace(%artists%,Armin Van Buuren,Armin van Buuren))
$setmulti(artists,$replace(%artists%,Sharon Den Adel,Sharon den Adel))

I also tried to include "; " somewhere in the script, but the tag still wants to be saved as a single-value tag. I chose the approach to replace each tag value separately, because sometimes I just want to replace only one of the artists from the tag, e.g. in “Armin van Buuren; Adam Young” I just need to replace the first artist.

Can anyone help me with this script? Much appreciated!

The above script with $setmulti definitely works for me, but I’m a bit confused because all of the releases I found on MusicBrainz already had “den” and “van” lowercased (as it should be).

So a few questions:

  1. Do you actually use this script for some release loaded from MusicBrainz or just on your local tags
  2. Which release from MusicBrainz is affected (some example)?
  3. Is the tag actually a multi value tag without replacement? If not, what exact value does it have (e.g. is the separator really "; ")?
  4. How do you see it is not a multi value tag after applying your script? Does it have only a single value when editing the tag in Picard or is it only single valued after saving to the file?
  5. What file format are you saving to?

Also make sure to use the latest Picard release. In case you want to only fix local tags your local tags without data loaded from MB (in the right pane) you should try to run your script manually (select the files, right click, choose Run Script > Your script name).

1 Like

I use Smart Title Case plugin because I like to have everything capitalized except join phrases and artist intent, so things like “The”, “Of”, “And” and “By” are all capitalized if it’s not part of the join phrase or artist intent, and “van” from “Armin van Buuren” is an artist intent (well, it’s his real name).

To answer your questions:

  1. I am loading releases from MusicBrainz
  2. This is one of the recordings I am trying to tag:
  3. I don’t completely understand what you mean here, but the tag is a multi-value tag because I got a perfect match of the “Artists” tag if I disable the plugin and my tagger script
  4. I can see that it will become a single-value tag after I save the file and open it in Mp3Tag (or check the header in notepad)
  5. I am saving it as an mp3 file in the ID3v2.4 UTF-8 tag

This is how it looks in Picard 2.1.0 dev3 (I think it behaved the same in 2.0.4 and even in 1.4.2 but back then we didn’t have the same TXXX:ARTISTS tag so I didn’t know about this issue):

You can see that the tag matches if I disable the plugin and the related tagging script:

Nevermind all of the above, I managed to fix the issue. I still had other artists replaced with the $set variable and that was causing the issue. E.g. I still had “$set(artists,$replace(%artists%,T.A.T.U.,t.A.T.u.))” in the same script but I didn’t know it could cause issues on tags where the value “T.A.T.U.” is not present. After I changed all of the “$set(artists,” bits into “$setmulti(artists,” the issue is now gone.

I will leave my previous reply here in case someone will use the same setup and encounters a similar issue :slight_smile: