Picard script for handling instrument families and more

Does anybody happen to have a script that you can run on your present files that can replace the names of instruments? (and leave the performer related to it intact)

So that it is able to change names such as “membranophone”, or “drums (drumset)” to just plain “drums”, and “guitar family” to “guitars”?

(using the ‘Standardize Performers’ plugin, in case that’s important)

.
edit:

I have been playing around with this a bit myself, but I run into two problems.

This:

$set(performer:drums,%performer:membranophone%)
$unset(performer:membranophone)

seems to work, but it won’t remove the existing ‘membranophone’ tags from my files.
Is there a scripting command to remove it?
(without resorting to checking ‘clear existing tags’ in Picard)

Second problem:

When I try to use an identical script for “drums (drumset)”, Picard throws an error at trying to enter it.

$set(performer:drums,%performer:drums (drumset)%)

Surely that’s because of the parenthesis around ‘drumset’.
How to circumvent that?

Thanks to @outsidecontext I now have a script working for replacing an instrument name.

To avoid ‘instruments’ such as “membranophone”, and “guitar family” polluting your library, this seems to work:

$set(performer:drums,$get(performer:membranophone))
$unset(performer:membranophone)
$set(performer:guitars,$get(performer:guitar family))
$unset(performer:guitar family)
$set(performer:guitars and solo,$get(performer:guitar family and solo))
$unset(performer:guitar family and solo)

I would also like to have the script catch instances of both “membranophone” and “drums (drumset)”, and write either of them to “drums”, but I haven’t succeeded yet in getting them to work together.

Also, notice that the above script won’t remove existing “membranophone” or “guitar family” tags from your files.
(unless you have “Clear existing tags” enabled of course)

2 Likes

I might have succeeded in combining these. (and I added some ‘guest membranophone’ I encountered that wasn’t a guest at all)

This seems to work nicely for now:

$set(performer:drums,$if2(%performer:membranophone%,$get(performer:drums \(drum set\)),$get(performer:guest membranophone),$get(performer:additional membranophone)))
$unset(performer:membranophone)
$unset(performer:drums \(drum set\))
$unset(performer:guest membranophone)
$unset(performer:additional membranophone)
$set(performer:guitars,$get(performer:guitar family))
$unset(performer:guitar family)
$set(performer:guitars and solo,$get(performer:guitar family and solo))
$unset(performer:guitar family and solo)
$set(performer:violins,$get(performer:violin family))
$unset(performer:violin family)

I am not very versed in Picard scripting, so use this at your own risk, and feel free to comment, or propose any additions.

(updated, violin family > violins added)

.
Important note:

The script gives good results for me when using the Standardize Performers plugin.
Without it it might not result in what you are expecting/hoping for.

.
EDIT
Updated version to be found here:

2 Likes

Nice work!

For the incorrect guest credits, did you also correct it at the source?

1 Like

Thanks, no I haven’t.
Until now I have not been active in editing data/albums to MusicBrainz, so doing edits without having experience or focus at the moment seems like a bad idea.
I will probably try and become active with that the coming winter.
(and after the membranophone issue has been solved)

It’s good to be cautious in making changes to the database, but this would actually be a great place to start. It’s a minor change that’s easy to undo if there’s any disagreement. It might even be automatic, not sure.

Anyway, if it helps, I fiddled around with your script and determined that with Standardize Performers you can unset the solo and guest credits on their own.

1 Like

You are probably referring to my post here?:

It is not about removing ‘solo’.
It is about Picard leaving out the instrument for that solo role.

(which indeed seems related to 'Standardize Performers, but I’ll have to do some digging what’s happening exactly)

Yeah, standardize performers will separate the solo credit from the instrument credit. Guess it depends on whether you care that so-and-so played solo guitar vs just any guitar in the piece. To me it’s a good thing, because I just want to see person and instrument

You are certainly right in the sense that ‘guitar’ is an instrument, and ‘guitar solo’ is not.

Still, I have quite some tracks with more than one guitar player that contain a great guitar solo.
For these tracks it would be nice to see who is playing the solo.
But the guitar player would probably need to have two credits then.
One for playing the guitar, and another one for playing a guitar solo.

1 Like

Found a hole in your script I think. What happens when there is an “and” in there? Like “Performer:membranophone and percussion”. or “Performer:clavinet, farfisa, membranophone and piano”

Is there any way to tweak this to allow for those ands? I also expect the membrananaophone to appear either side of that and. Where are those scripting wizards to answer our puzzles? :smiley:

Here is a good example of odd combinations of instruments.

The first track has two different drummers who also play other items on the same track. Track 10 is handclaps and membranophone. So lots of combos in there to test a wildcarded script.

Thanks for trying it out and giving feedback.

I am sure the current script won’t catch everything that might be out there.
But I have run it on a couple of hundred albums by now, and it worked perfectly for all of them.
If you or I (or anyone else) run into it not working well in a specific case, please let me know and I’ll see if I can fix it.

To make it completely perfect I would probably better resort to using regex, but since it is working very well already I am reluctant to put effort in that.

I ran the script on the album you mentioned.
These are tracks 1 and 10:

It looks hunky-dory to me?

1 Like

I was tagging a heap of MP3 files. And this album did trip up when I used the earlier version of your script. (The six line version earlier in this thread)

The main difference I have is I still have lots of “and” joiners in the instruments. Look at the following for track 1:

image

I assume this fails to match because the instrument is see as a “[membranopone and percussion]”. How have you got yours to list every instrument separately?

Note: I am still using v1.4.2 of Picard as I am waiting for the bug fixes to calm down before moving to v2.x

It’s probably because I am using the Standardize Performer plugin and you are not?

I have been using 2.0.4 for a while now, and I must say I am very content with it and not aware of any problematic bugs.
Also many plugins have been updated to work well with 2.x.

2 Likes

What does a “Standardize Performer Plugin” do? Is it a standard I need? (pootles off to go read a help file somewhere…)

Answers own question: For once that help description made sense. You get the separated list per instrument like your screenshot, not the list per performer like my screenshot. So it is now about to be added to my standard setup as that makes lots of sense to me looking like that.

I have just stayed off Picard 2.0.x for now as the initial releases seemed a bit Beta-ish to me with initial feedback. Especially as I watched all the plugins then catch up. I’m waiting for v2.1 before I jump in.

Correct, it’s not needed, and it probably depends on how the player/manager you are using displays these kind of tags.

Yeah… I noticed I threw it in a little too quick. As I am weird, I like to keep some of the old tags in a file as I will have other notes about where they came from. So turning this on caused a bit of a mess. I had expected it to also remove the previous performer tags from a file before putting the new ones in. Instead it wanted to add all the single instrument entries in alongside all the “x and y” entries. Eeek!

Leave that for another day…

So I would edit your posts up there next to the scripts and make sure people have the “Standardize Performer Plugin” enabled to make your simple script work the best. I notice you mentioned it in your first post on this, but I ignored that. :smiley: Worth pointing out that it is important.