Tagger Script set to Automatic - When exactly is it Applied?

Tagger scripts that are [X] Ticked are automatically acted on … but exactly when?

If an Album automatically goes to the Album side because it’s already got an MBID and Ignore MBIDs when loading is disabled:

Does the Tagger Script get run the moment the tracks go to the right or does it get run -AFTER- the [loading album information] happens?

I’m trying to work out a way to intercept existing tags if they’re set to a certain value before Picard would apply any changes it gets from the MBDB or other Plugin Fetched data.

$set(genresort,$if2(%genresort%,%genre%))

This example will set %genresort% to with the value of %genre% if does not already contain a value.

I want to move whatever is currently in the Genre tag to another tag if it’s not been done already. So I can let Picard have control of the Genre tag contents and I’ll move my custom stuff to another tag.

If I want to make sure it’s applied to everything, do I need to set Picard to ignore existing MBIDs (so that everything loaded stays to the Cluster side and manually apply the script myself or can I let it do it automatically and catch those that already have an MBID, grabbing the value from it before it gets updated?

Scripts are executed as part of the loading process on the right. Scripts run after the data has been loaded from MB.org and after all metadata processor plugins have been run. They are one of the last steps in the loading process.

If you want to automate this you’ll need a plugin implementing a file_post_addition_to_track_processor event hook, see Appendix A: Plugins API — MusicBrainz Picard v2.10 documentation

Scripting is insufficient for this since scripts run at a time where often there is no file available and scripts don’t have access to the files metadata.

2 Likes

The reason I asked was because from a quick look I was coming to the conclusion that it was done after all the load, but because I have this to “backup” tag data … and this is working as desired, but the genre bit was not always working.

I realize now that because those variables I’m backing up are still valid on the right because the files have not been saved yet. So if %genre% were not updated by the information loading then it to would retain the value that was there, too.

With a little more finishing out this could allow for “undo” operations similarly to the way Song Kong will undo all the changes. Though it would not be able to return files to their original location directly as Picard probably needs some tweaking to write anywhere besides with reference to the Destination Directory setting from script commands.

Which I’ve been trying to figure out a way to do that, too. But for another thread. :slight_smile: