Scripts¶
There are two types of scripts used in Picard: the file naming script and tagging scripts. These are managed from the “File Naming” and “Scripting” sections of the Picard scripting language. Scripts are often discussed in the MetaBrainz Community Forum, and there is a thread specific to file naming and script snippets.
menu. All scripts are written using theFile Naming Script¶
There is only one file naming script defined in a user’s settings, although it can vary from a simple
one-line script such as %album%/%title%
to a very complex script using different file naming formats
based on different criteria. In all cases, the files will be saved using the text output by the script.
Note
Any new tags set or tags modified by the file naming script will not be written to the output files’ metadata.
Tagging Scripts¶
There can be multiple tagging scripts defined in a user’s settings. Individual scripts can be enabled or disabled, and the order of execution of the scripts can be set. Whenever a script is run automatically (i.e.: when an album is loaded), it is processed once for each track in the album that triggered the run. For example, if there are two tagging scripts enabled (A and B) and an album with three tracks is loaded, the scripts will be processed in the following order:
Script A Track 1;
Script A Track 2;
Script A Track 3;
Script B Track 1;
Script B Track 2;
Script B Track 3.
Metadata updates are not shared between tracks, so you cannot append data from one track to a tag in another track.
Any new tags set or tags modified by the tagging scripts will be written to the output files’ metadata, unless the tag name begins with an underscore. These “hidden” tags are typically used as variables to hold temporary values that are used later in either the tagging or file naming scripts. Tagging scripts are run once for each track in the data, using the metadata for that track.
Tagging scripts can also be run manually by right-clicking either an album or a track in the right-hand pane in Picard. If run from the album entry, the script is run for each track in the album. If run from an individual track, the script is only run for that track.