Help with script with performer tags

Hi, my first post here.
I’ve been using Picard for a few weeks now, and I’ve set up some scripts to get what I want.
I’ve hit a stumbling block with a scenario that should be easy, but seems to be impossible for me to work out.

I want to change performer tags with no instruments to a tag called performer:various, but I only want to do it where the person is not already listed somewhere else as a performer for the track.
For instance, Ed Sheerin is listed as performer on this track, as well as vocals and guitar.
https://musicbrainz.org/recording/07a4f279-5499-4338-bec5-a00dca4b1037?tport=8000

My script looks like it works here:

$setmulti(_perflist,$performer(,; ))
$copymerge(_perflist,%_perflist%)
$setmulti(performer,%performer%)
$foreach(%performer%,
    $if($not($inmulti(%_perflist%,%_loop_value%)),
    $setmulti(performer:various,%_loop_value%,; )
    )
    )
)
$unset(performer)

The issue arises when I have multiple empty performers, but only some of them are already listed:
https://musicbrainz.org/recording/9037fd5b-e74f-49c9-90aa-9c8d08ee160a?tport=8000

benny blanco and Rick Ruben are both listed as performers, along with Ed Sheerin, but neither have another performer role, so I’d like them to display as performer:various.

If I set each one as a separately labelled tag it works:

$set(performer:various%_loop_count%,%_loop_value%)

What am I missing?

2 Likes

welcome dmcswee i wish i could help but scripting is a bit above my head someone like jesus2099 may be able to help you you may just need to wait till they see it due to time zones and life while you wait take a look around there is plenty of talk around scripts on here you may find something that may help while looking

1 Like

Two things:

  1. Instead of $setmulti for setting the performer:various tag you better should use $copymerge, to retain previously set values
  2. $copymerge behaves a bit different as you had expected: It needs variable names for both the first and second parameter, not actual values ($copymerge(a,b) instead of $copymerge(a,%b%)).

So with this the script should I think be like this. Note the call to $copymerge(performer:various,_loop_value), and I also added some comments to other parts of the script:

$setmulti(_perflist,$performer(,; ))

$noop(The following copymerge is not really needed, but it ensures
_perflist contains only unique values. It doesn't change the working of
the script, but maybe _perflist is used elsewhere)
$copymerge(_perflist,_perflist)

$noop(Again not really needed I think, but makes sure performer is
an actual multi-value tag)
$setmulti(performer,%performer%)

$foreach(%performer%,
    $if($not($inmulti(%_perflist%,%_loop_value%)),
    $copymerge(performer:various,_loop_value))
)

$unset(performer)
1 Like

And I also want to say that your script is really really awesome. I think this is a great idea which makes use of the more advanced possibilities in scripting. This gets into my personal collection of useful scripts.

2 Likes

And finally provides an excellent real-world example of the use of the $foreach() function (and justifies my adding it to Picard). :wink:

2 Likes

Thanks, st3v3p. I’ve been lurking and browsing the forums for a while, and I was just stuck. There certainly is a whole lot of knowledge and advice here and I’ve already picked up some things and put them in place.

2 Likes

Thanks heaps outsidecontext, this works perfectly. I had tried $copymerge, and various iterations of using $setmulti, $copymerge and $set different combinations. If anyone can see a log of Picard requests for that Ed Sheeran album (being it contained a perfect example of what I was trying to achieve) there’s probably some 500 odd attempts at refreshing and changing the script to see if it worked.
I like to think I’m pretty good at scripting and coding in general, and it was just a matter of specific syntax. The tagger script syntax is a little awkward to get used to so I just couldn’t work it out.
I’m glad I can contribute to your personal collection! I’ve already added many of your contributions from across the forum to my collection.

2 Likes

Glad to have proven it useful! Now I just gotta work out how I want it to play with your excellent performer plugins, rdswift.

1 Like