Is there a way to add tags that aren't in the Edit Tag dropdown?

I’ve started using some tags that aren’t available with the default Picard install and was wondering if there is a way to add them so that they always appear in the Edit Tags dropdown?

As an example I’m using tags called %albumtranslation% and %translation% so I can have the English translated album/track titles appear next to the Japanese titles in Foobar as per my screenshot below. I don’t mind typing them out but doing it for thousands of albums get’s a bit tiresome so having them always in the dropdown box would be really nice:

There is no official way to do it currently. There is however a bit of a hack to achieve this. If you place a text file extratags.py in Picard’s plugin folder with the below content it will add the tags to the default list:

from picard.util.tags import TAG_NAMES

TAG_NAMES.append("albumtranslation")
TAG_NAMES.append("translation")

You can add additional tags as you wish. Please note that I wrote the above from memory, if something does not work let me know.

The above is no proper plugin and it kind of exploits a weakness in Picard’s plugin system, as Picard will run any Python code placed in the plugin folder.

We would like to rework the plugin system for Picard 3, which would then make the above no longer work. But then I think we can also have an official way to extend the tag list.

You need to decide where you are going to get your data from. English translations of non-Latin scripts are often available in MusicBrainz, so the question breaks down into the following separate issues:

  1. How do you get hold of the English translations from the JSON returned to Picard by Musicbrainz and put them into the variables you have defined? A plugin should be able to achieve this, but it might require a second API call. Or you can write a PR to Picard to put these into a hidden variable, and you can then use a script to copy them into these visible variables (and this would be what I would recommend). (Or we could enhance Picard to make the JSON returned available to plugins if this is not already the case, which might be a half-way house.)

  2. Will these variables be written to the file as tags? Some formats save everything, some formats only save a specific list of visible variables, so it will depend on the tagging format that the file type uses. (IMO Picard should be enhanced to save and load all visible variables to all formats, but this is not currently the case.)

I’m just adding the English details manually from VGMDB via copy and paste so nothing fancy is needed. Thanks for those details outsidecontext, I’ll give it a try.

Maybe I’m not understanding what @Deleted_Editor_2217391 is requesting, but couldn’t this be done with a tagger script like:

$set(albumtranslation,$if2(%albumtranslation%,%album%,Not set))
$set(translation,$if2(%translation%,%title%,Not set))

What I’m after is for those or other tags I may want to use to appear within this dropdown permanently:

If you are adding details manually then create a script with the following lines:

$set(albumtranslation,%album%)
$set(tracktranslation,%title%)

These should then always appear in the list.

Unfortunately this hasn’t worked, maybe whatever weakness of the plugin system it had was fixed recently? However the script that Sophist suggested above works so I’m happy with that, it auto adds the tags for me and I can just delete what I don’t require. Thank you both for the assistance.

1 Like