A script to change (and reorder) tag names?

I am hitting a brick wall in imagining how to do this:

When a recording has an artist role credited as e.g. “additional guest guitar”, Picard will render that to something like:
Performer [additional guest guitar], and in my music manager that will then show up as e.g.:

additional guest guitar: Mike Stern

That’s o.k., but I would like to change that a bit.
I would like it to display as:

guitar, additional [guest]: Mike Stern

This because it will keep the instruments together in an alphabetical listing, and it separates the word ‘guest’ a little bit from the instrument and brings it closer to the performer.
After all ‘guest’ says something about the performer, not about the instrument.

(Idealy I would like it to display: guitar (additional): Mike Stern (guest), but that will probably have all kinds of complicated repercussions, so I’m not aiming for that now)

I have been able to achieve it for one tag with a small script like this:

$set(performer:guitar, additional [guest],$get(performer:additional guest guitar))

But the problem is that this script of course will only work for tags with the exact name “additional guest guitar”.
It will not work for “guest guitar”, “additional percussion”, etc. etc.
Creating separate scripts for all other possibilties seems very silly, and is probably also close to impossible.

So I would like to have a script that is able to look in all tag frames for attribute names such as ‘additional’, ‘guest’, ‘solo’, etc., and re-order them, and/or put brackets around them.

Is this even doable with scripting?
If it is, any hints how to approach this?

I think this needs a plugin to do it, because with scripting you don’t have the ability to query variables by partial name nor the ability to loop over them.

The issue here is that the interesting data you want to modify lies in the variable name and not it’s value.

1 Like

Thanks, I was afraid of that.
I was hoping it was achievable with scripting, since I could then also use something similar to create a simpler and catch-all version of my replace membranophones/families script. (it would just need to find and replace these words)

Writing a plugin will be way beyond my capabilities.
So I guess I will be making a couple of scripts for only the tags where this matters to me the most.

Up till now this seems to be working quite well I must say.
This is result of how it now looks in my music manager:

instead of this:

It needs lots of lines of script code, (6 lines per instrument…) but I think it’s worth it.
(grouping the instruments so keeping them together, and placing ‘guest:’ in front of the artist instead of in front of the instrument)

I am also posting this as some teaser, perhaps getting some opinions or feedback.
Hoping that something like this could perhaps be implemented out-of-the-box in Picard without the need of scripting.
Or perhaps some talented coder can create a plugin that is able to do this?
(Standardise Performers DeLuxe Edition? :wink: )

While trying to create a script to re-order tag names for the purpose of creating a more logical (reading) order for attributes such as ‘additional’ and ‘guest’, I got inspired to also create a script to re-order tags related to ‘vocals’. (so they will display grouped too, just like other instruments)

This scripting of mine seems to be going rather well, so I thought to share the fruits of my efforts so far.

It’s one single behemoth of a script.
(to be found at the bottom of this post)

What it does:

  • It transforms ‘membraphones’ and ‘drums (drumset)’ to ‘drums’, and it transforms instrument ‘families’ to plurals of these instruments.
    e.g. ‘guitar family’ and ‘trumpet family’ become ‘guitars’ and ‘trumpets’

  • It re-orders the tag names a bit more ‘natural’ (just my opinion) so that e.g.:
    “additional guest drums: Gonzo” becomes “drums ‹additional› guest:Gonzo”

  • It renames all ‘vocals’ tags so that they are grouped in an alphabetical manner. (always beginning with “vocals”)
    e.g. “guest tenor vocals: Andy Kaufman” becomes: “vocals ‹tenor› guest:Andy Kaufman”
    (oh, and it changes ‘spoken vocals’ to ‘vocals ‹spoken word›’ )

.
example screenshots (MusicBee):

this:

becomes this:

.
Notes:

It is created for (and tested with) MusicBee, using Sophist’s ‘Standardise Performers’ script for Picard.
So no guarantees whatsoever when you don’t use the ‘Standardise Performers’ plugin and MusicBee.

No guarantees whatsoever.
(I am no coder, so if you are interested in this script, try it out thoroughly on back-up files first)

I haven’t included a solution for the ‘Solo’ attribute yet, since that function is currently broken at the Picard side so I can’t test it.
(this is probably going to be fixed with a next release of Picard, so I’ll try to enhance my script for it when that is done)

update:
I have added ‘solo’ to the script now too, and it seems to be working very well with Picard 2.0.5.dev1.

It has all been setup to my personal preferences.
I am open to any sensible suggestions for improvement though.

.
edit:
I found that the script wasn’t working as intended for instrument names that originally had capitals in them (such as Rhodes piano)
That’s fixed now. To those that already downloaded the script; please re-download.
.


download:

edit:
I removed the download link for the script.
rdwsift has created a plugin for this purpose that does a much better job:
https://community.metabrainz.org/t/picard-plugin-performer-tag-replace/402266/3

I like the look of these scripts, but I don’t use the “Clear all previous tags” options in Picard as I like to keep other tags.

Is there a way of adding to your script a “delete all instrument tags” first? Some kind of wildcard reset before putting in that nice neat list.

BTW - your example looks little odd. How many different Terry Williams’ were playing drums on that track? Did he clone himself?

Not currently.
I also don’t use ‘Clear all previous tags’, so I am using the ‘remove specific tags’ function in my music manager to delete the instruments/performers tag before running the script.

If I am correct, there is a chance that in a future release of Picard there perhaps will be an option to delete specific tags only.
That would be very useful indeed and I would certainly use it for this script.

Please don’t mind all those Terry Williamses (is that plural for Williams?)
This is just a made-up track with a very busy entourage of musicians I constructed for testing purposes only.
For the majority of actual tracks the result will look far less cluttered.

edit:
Actually, I now see that the Terry Williamses from my earlier screenshot came from duplicate entries in the MB database itself:

.


Let me know if you ever encounter errors or duplicates in the placement of artists/instruments?

Again, please test it thoroughly on test files first.
I myself have tested it on many hundreds of tracks by now, and I am quite confident about it workings.
But there could always be some unforeseen circumstance that I am not aware of at this moment.

I think I need to find a better tag manager to better help me clean up selectively… :smiley: Ideally I’d point it at a number of files to clear the instrument tags out completely and then use Picard with the Standardise Instruments plugin and your script. That looks like creating nice clear lists then.

I can’t really test this much before then. When I tried it out before, alongside enabling the Standardise Instrument plugin, I ended up with a comical mess due to all the old instrument tags being in place still.

The main reason I pointed out Terry Williams appearing so often was in case it was a bug. The fact he is playing drums (once) and also playing drums additional (twice) made me wonder.

Ah - now I see what is going on. Now I follow through to the track I see he is on both Additional Drums (drumset) and also Additional Membrananophonoium. So he is correctly appearing twice as Additional Drummer.

But that still leads to a mistake in your list. If that was supposed to be Brothers In Arms / Money For Nothing then look again at the drummer(s). Omar Hakim is the drummer, and Terry Williams is an additional mebranophonionionist on a single track. This is not what you are showing in your example. Somehow you have also put Terry on drums alongside Omar. And got Omar in to guest drums on the track he is the main drummer on.

Surely it should be:

drums: Omar Hakim
Additional Drums: Terry Williams, Terry Williams.

1 Like

Thanks for the feedback, and well-spotted.
(but… you are referring to an earlier screenshot from when I was still fooling around a bit, and before I created and published the ‘final’ script)

I just ran the track through the ‘final’ script, and everything looks perfect:
(with two additional drums Williamssess as you predicted)


.

But now you’ll notice another oddity that at first I couldn’t explain myself:
Omar Hakim is now also credited twice (drums and guest drums), while on MB you’ll only see him as ‘drums’ on the track listing.
And also there are now even three Williamssessesss!

But scrolling down the webpage revealed that both drummers have additional credits for the whole album too.
So this example accidentally happens to reveal that in such situations Picard itself will create ‘duplicates’.
It has nothing to do with the script.

An interesting find though!

.
Just for reference/comparison, Picard without my script:

1 Like

It’s the way my head works. I see oddities… which is useful for testing.

I wonder what was originally entered for the instruments? It is noticeable that Terry is credited at the main Membradnonododophone player and Omar is a guest Membradsoneophne player.

Yet when it comes to drums (drumset) it is Omar who gets the first credit.

I would think this also shows an interesting situation… can your clever tagging script remove the duplicates?

Have a look at the cover images as the booklet has been scanned.

And that is the only place in the booklet where the instruments are listed. I wonder where the overly verbose details have come from? They seem to clash slightly with the booklet.

Oh yeah - that list shows a simple:
Drums: Omar Hakim / Terry Williams

I am trying to make sense of the editing history.

https://musicbrainz.org/edit/6337880
https://musicbrainz.org/edit/10867578

Does that imply that a merge has caused this? Users merging tracks that look the same but not bothering to check or clean up the duplicated credits?

Can’t see where the membrainodonophones have come from.

Let’s separate these two issues.

How ‘membraphones’ was introduced to MusicBrainz can be found by a forum search.
It was a mishap, and it will be reversed.
My plugin just mitigates the effects. (and it of course re-orders instrument names)

The issue I am interested in for this album, is how at first look it seemed like my script was populating duplicate entries. (it almost made me pulling some hairs out)

But when I saw that Picard did the same without my plugin, I looked more closely and saw that they are not exact duplicates.

Then checking the MB webpage for that album, you’ll see that for the track it says ‘drums’ Omar Hakim, and 'additional drums (+membranophones) Terry Williams.

But at the bottom for album credits it also has entries for these roles, but then sort of the other way around.
It says ‘drums’ (membranophone) Terry Williams, and ‘guest drums’ Omar Hakim.

So I am guessing Picard is doing what it should do, and so is my plugin.
They are just retrieving (and re-organizing) all these instrument roles.
That’s why we end up with five drummer roles instead of just two (as it should be) for this track.
(edit, it even should be just 1, see below)

So the origin of the problem is how these credits have been entered for this specific album in MusicBrainz’ database.
Perhaps an experienced editor can chime in if this is indeed a release where there is something wrong with these credits…

edit,
I just did a quick check. On the scans you linked to it only mentions drums: Omar Hakim/Terry Williams for the whole album.
On one specific Discogs page I found it says: Drums – Omar Hakim, Terry Williams (3)

So drawing a quick conclusion without more thorough investigation I am now guessing that for drums, all ‘guest’, ‘additional’, and album release credits should be deleted, and all tracks should have: “drums: Omar Hakim”, except track 3, which should say “drums: Terry Williams”.

1 Like

Yeah, I agree that your plugin is working correctly. You picked a good test subject there. :grin:

When the membranophones get reverted to drums (drumset) won’t the confusion will still be here on this release?

I am certainly interested in hearing from experienced editors on what has happened with that album. Two drummers but they are both guest and lead drummers. The different sources are clashing somewhere. Leading to a doubling of credits. Maybe worth a separate post.

It looks like I did :wink:
But it also shows an advantage of my script ordering the same instruments together.
It makes it much easier to spot such errors in the database.

2 Likes

I updated the script.
See post #5 for details and download link.

edit:
I removed the download link for the script.
rdwsift has created a plugin for this purpose that does a much better job:
https://community.metabrainz.org/t/picard-plugin-performer-tag-replace/402266/3

1 Like