I gave this a go with a slightly different approach:
Note: The functions names starting with
$album_ were previously called
$releasetag_. I changed this with an update to version 0.4 and have updated this post accordingly.
This plugin provides a couple of functions that can be used to get aggregated values from all files on the release. Note: Due to technical limitations these functions work only when used in a naming script.
E.g. one can use the following to get a common media (note: variable names must be passed by name, e.g.
media, not with value, e.g.
If all files have the same value for
media (e.g. “CD”) that value will be returned, otherwise it will be empty. You can use this to just check whether all files have the same type or not:
$if($album_all(media),all same media type,different media type)
For handling numeric values e.g. for including the bitrate in a folder name there are
$album_avg(). E.g. you could do a bitrate range:
Or to have it use only a single value if all files are identical combine it with
Another option is to use an average bitrate:
For something like genres you might want to use the most common value. There is
$album_mode() for this:
If you have 4 files tagged with a genre of “rock” and 3 with genre “metal” this will use “rock”. Now often there are multiple genres in a file (that means a genre tag is a multi-value tag). Let’s assume we have a release with individual tags tagged with the following genres:
- rock; metal
- rock; blues
- rock; metal
- blues; alternative
- blues; jazz
$album_mode(genre) would pick “rock; metal” as the genre, because this is the most common combination. But maybe you want the most common single value? There is
$album_multi_mode() for this:
This looks at all the values individually and hence will give “blues” (which is used 4 times, followed by rock 3 times).
There are also multi tag variations of min, max and average (
To install the script the easiest is to download the file releasetag_aggregations.py from https://raw.githubusercontent.com/phw/picard-plugins/releasetag_aggregations/plugins/releasetag_aggregations/releasetag_aggregations.py and install it from inside Picard via Options > Plugins > Install plugin…