A script to write 'work' to the 'title' tag?

I’ll skip voicing my frustrations about not being able to find how something that I am guessing is very simple can be accomplished.

I want the contents of ‘work’ getting written to the ‘title’ tag.

This indicates to me that should be possible:

(b.t.w. I can’t find a setting called ‘Advanced Relationships’ in Picard)

Since I also couldn’t find a ‘scripting for dummies’ tutorial anywhere, I guessed something like this might work:


But it doesn’t.

Some help would be appreciated a lot.

Since the word ‘work’ seems to have dozens of interpretations, this is what I am referencing here:

1 Like

I believe that the Use track relationships option is what you will need to get the Work information.

I assume you looked at https://picard.musicbrainz.org/docs/scripting/ and the links included on that page?

Looks like you have the assignment going the wrong way. Try:


This should set the title variable to %work% if it exists, otherwise it is left as %title%. Does that do what you’re after?


Thank you rdswift!

Yes, that does exactly what I tried to achieve.

I had indeed checked the ‘use track relationships’ and I have read many MusicBrainz webpages (including the one you refer to), but one aspect that seems to be absent in many ‘tutorials’ on the MB website is the simple basis:

“What does this do”, “why would you use it” and “here are some examples:”.

I’m glad that guys such as you are active in the forum :wink:

1 Like

And a second question that follows from this:

I have added ‘work’ to the ‘preserve tags’ list.
But it is still being written in this scenario.

I am guessing that is because it was empty to start with, and the setting only prevents overwriting a populated tag?
Yet I want to preserve the ‘empty’ state for this tag.

How can I do that?

I found I can use ‘remove’ from the context menu, but if possible I want to have this as a fixed state, and not as a one-instant feature.

I assumed wrong here: ‘remove’ doesn’t prevent Picard doing anything with/to that tag, but it actually deletes it.

I’m not 100% sure I understand what you’re wanting to do, but perhaps something like this:




If I’ve missed the mark, please clarify what it is you’re wanting (if you can).

Thanks again! I’ll try that tomorrow…

A brief clarification and summary: I want the contents of MB’s ‘work’ to be written to the ‘title’ tag, and I want the ‘work’ tag frame to remain blank if it was blank before.

Sorry to be brief, but $unset(work) after setting the title.


I thought there was an $unset() function, but I must have skimmed right by it when checking. Yup, that would be the one to use to remove the tag.

I may have misunderstood, but I thought @hiccup was wanting to keep the work tag even if it was empty. That’s why I suggested setting it to an empty string or “missing”. After re-reading his note, you may be right, in which case $unset(work) is the best solution (as you suggested).

1 Like

The best way to say what I want might be: "I want the ‘work’ tag untouched"
If it was empty before, leave it empty. If it had a value, keep that value.
I don’t want Picard to do anything with/to it.

I probably raised some confusion because I spoke about: " remove’ from the context menu"
I was referring to the ‘Work’ cell at the bottom left of Picard. But I wrongly assumed that that would prevent Picard from doing anything with ‘Work’. But I now see it actually removes the ‘work’ tag frame itself.
Isn’t it possible to ‘prevent changes’ to a tag from the user interface?

Then if I need a script for that, the next challenge(s) arise:

  • Is it explained somewhere what “$unset” does? I can’t find an explanation in the documentation.
  • How do I add such another script?
    Do I add it on the same page as the script I am using to write ‘work’ to ‘title’?
    Or do I add it on a new page? But that confuses me too. If I click ‘add new script’, a new page opens (My script #), but then the previous page is gone, and I can see no way to get back at it? Will the script on the previous page still run? Can you activate/de-activate it?

Do you have this problem?


Thank you MetaTunes!

So this is a known user-interface bug, with a ticket, and it hasn’t been addressed for six months now?

There are a lot of outstanding Picard tickets. Bear in mind that all work on Picard is entirely voluntary! Also, effort is being directed to v2.0, I think, rather than fixing v1.4. I decided to brush up my Python and write my own plugin because I thought that would be the best way of getting Picard to do what I wanted, but I appreciate that’s a personal choice :grinning:

1 Like

Thanks WovenTales, I’ve got it working now.

Just to have a complete answer, the following script should do what you want: