My tagger scripts and plugin for MusicBrainz Picard 3, tested against Picard 3.0.6.
| File | What it does |
|---|---|
01-remove-hyphens-in-title.ptsp |
Replaces - in titles with an en dash: Song - Live → Song – Live. |
02-set-subtitle.ptsp |
Title-cases the disc subtitle. |
03-use-original-date.ptsp |
Pads originaldate and date to YYYY-MM-DD (01 for a missing month or day). date becomes the original release date when there is one, unless it is already a more precise date within it: original 1995 with date 1995-03-02 keeps 1995-03-02. originalyear is the year of the final date. |
04-various-artists.ptsp |
Strips featured artists (feat., featuring, ft, meets, produced by, also in brackets) from the album artist and albumartists, keeping the main artist's sort name. Two or more main artists become Various Artists, with albumartists listing them and voice actors in place of characters; the actors inside a (CV…) credit don't count as main artists. |
05-voice-actor.ptsp |
Turns a character credit into the voice actor, in albumartist and albumartists: Chin-lan Chang(CV.Maki Kawase) → Maki Kawase, sorted as Kawase, Maki. Accepts CV., CV: and full-width (CV:…). |
Order matters. Picard runs scripts top to bottom, and Various Artists must run before Voice Actor. Keep them in file-number order.
With Picard closed, run mise run install-scripts (mise run install-all installs the scripts and the plugin). It writes the scripts into Picard's config and turns on Enable Tagger Script(s):
- These scripts end up in file order. They take the places they already held, plus new places at the end, and your other scripts stay where they are.
- A script already there, under its name or with
(imported)appended (English UI), is replaced and renamed back. It stays enabled if any copy of it was, and other copies are removed. A new one is enabled. - If an enabled profile has its own script list, that's the one updated, as Picard reads it. It names any other profile that has its own copy of one of these scripts.
It saves a copy of the config first, next to it, with .bak-<timestamp> added to the name. It refuses to run unless the installed Picard is the version the tests use (PICARD_REF), because it writes the config with that version's code. PICARD_CONFIG_FILE sets the config file, for an install that keeps it somewhere else (Flatpak, Snap, portable). Such an install also needs PICARD_CLI pointed at a single program that runs its picard-cli, such as a wrapper script.
By hand: Options → Options… → Scripting. Tick Enable Tagger Script(s) if it isn't already, then Import and pick the .ptsp file. Picard adds it disabled, with (imported) appended to the name: rename it, tick it to enable it, move it into place, and delete the old version if you're replacing one.
| Plugin | What it does |
|---|---|
highest-disc-total |
Sets Total Discs to the number of discs with matched files and renumbers later discs to close the gaps: 1 for a CD+DVD release when you only have the CD, and discs 1 and 3 of 4 become 1/2 and 2/2. Restores the numbering when a missing disc is matched, and leaves alone a value you edit; add the tag to Preserved Tags to keep MusicBrainz's own value. On a release whose discs share recordings, saved renumbered files can re-match to the earlier disc when reloaded. |
From GitHub, so Picard can update it: Options → Options… → Plugins → Install Plugin…, then the URL tab, with Git URL https://github.com/robrich82/picards-scripts-plugins and Ref/Tag set to the latest release's tag, e.g. v1.0.0. Or, with Picard closed, picard-cli plugins install https://github.com/robrich82/picards-scripts-plugins --ref v1.0.0. Leave out the tag and the install fails: main has no plugin at its root. Picard sees a new release once it has checked for one: tick Options → General → Startup → Check for plugin updates during startup, or press Refresh All in Options → Plugins. The plugin's Update button then moves it to the newest release. For changes not yet released, use the ref dist/highest-disc-total instead. A plugin already installed from this checkout has to be uninstalled first.
From this checkout: with Picard closed, run mise run install-plugin. It copies the plugin to local-plugins in Picard's data folder (%APPDATA%\MusicBrainz on Windows) and registers it with picard-cli; run it again to update, which also re-enables the plugin if you'd disabled it. PICARD_CLI sets the path to picard-cli when it isn't on PATH or in the default Windows install folder.
By hand: Picard runs a local plugin from the folder you give it, without copying it, so first copy plugins/highest-disc-total somewhere it can stay (e.g. %APPDATA%\MusicBrainz\local-plugins\).
Options → Options… → Plugins → Install Plugin…, then the Local tab, and pick that folder. Answer Yes to the "not managed by git" warning.
Or, with Picard closed, picard-cli --yes plugins install C:/path/to/highest-disc-total on that folder. Use forward slashes: a path with no / is looked up as a registry ID. On Windows the command may end with a UnicodeEncodeError traceback while printing its result; the plugin is installed anyway.
Raise version in MANIFEST.toml and merge to main. release-plugin.yml copies the plugin folder's history to the dist/highest-disc-total branch, where MANIFEST.toml is at the root as Picard needs, tags that commit v<version> and creates the GitHub release. Merged plugin changes without a version bump only move the branch. Don't create tags or releases by hand: Picard updates to the newest tag that reads as a version (any <text>1.2 or <text>1.2.3, such as v2.0 or 2.0.0), so one without the plugin at its root breaks every update. The workflow fails, releasing nothing, while such a tag exists or when version is lower than the latest release.
The tests run every script, in file order, through Picard's real script parser on sample tracks, and load the plugin through Picard's plugin loader. They need git, mise and uv; mise install installs the pinned uv:
python tools/run_tests.pyThe first run downloads Picard's source (release-3.0.6) and builds a venv for it on the Python that requires-python in pyproject.toml pins, both in the git-ignored .picard/. Extra arguments go to pytest, e.g. python tools/run_tests.py -k CV (or mise run test -k CV). On headless Linux, Qt also needs libgl1 libegl1 libxkbcommon0 libfontconfig1 libdbus-1-3 libglib2.0-0 (Debian/Ubuntu names).
python tools/run_tests.py --coverage also measures line and branch coverage of tools/, plugins/ and .claude/hooks/, prints the report, and fails if any of it is uncovered (fail_under in pyproject.toml), so with only some tests selected it always fails. It is roughly three times slower.
To check a different Picard version, change PICARD_REF in tools/run_tests.py.
Ruff, ty and vermin are pinned in uv.lock, and these mise tasks run them with uv run:
mise run lint # ruff check, ruff format --check, tools/check_min_python.py
mise run format # ruff format
mise run typecheck # ty checkmise deps runs uv sync when uv.lock or pyproject.toml changed or .venv is missing, and mise exec, mise run and mise's shims run it first too.
check_min_python.py runs vermin on the files per-file-target-version in pyproject.toml keeps on an older Python, catching stdlib APIs newer than their target that Ruff doesn't. The tests run it too. Mark a call that a version check guards with # novermin.
ty check reads Picard's source and the test environment from .picard/, so run the tests once first.
CI runs these and the tests (checks.yml): a push to main runs every job, a pull request only the jobs its changed paths need (tools/ci_changes.py). The tests run with --coverage, so a pull request that leaves a line or branch uncovered fails; they also run on Windows, without coverage. Branch protection should require only the gate job, which fails when any other job does.
mise run format applies the formatting; .git-blame-ignore-revs skips the commit that first applied it (git config blame.ignoreRevsFile .git-blame-ignore-revs).