Skip to content

Lidarr

plyrix can run on each album Lidarr imports, so new music gets lyrics without waiting for the scheduled run. plyrix lidarr-hook is made for Lidarr’s Custom Script connection: it runs plyrix on just the folders of the album Lidarr imported, and then refreshes that album in Plex when Plex is configured.

Run plyrix from Lidarr after it imports an album, not from a download client such as qBittorrent when a download completes. Lidarr renames and moves files on import, so a sidecar written in the download folder would be left behind or misnamed. Lidarr runs the connection after the files are in their final library folders, and passes their paths to the script.

  1. In Lidarr, open Settings, Connect, and add a Custom Script.
  2. Tick both On Release Import and On Upgrade. On Upgrade alone does nothing, as Lidarr only reaches it from inside Release Import.
  3. Set Path to the shim for your route, below. Lidarr passes the script no arguments.
  4. Press Test. A Test event does no work: it checks that the settings load, that music_root is a folder and that the spool can be written, and Lidarr shows an error when one of them fails.

Lidarr describes the album in Lidarr_EventType, Lidarr_AddedTrackPaths, Lidarr_DeletedPaths, Lidarr_Artist_Path and Lidarr_Album_Id, as its source spells them. Lidarr 3.1.0.4875 on Linux sets them in lowercase, such as lidarr_eventtype, as a real Lidarr showed on 2026-11-15, so plyrix and the shims read either spelling. An upgrade is an import with Lidarr_DeletedPaths set. Every other event, Rename included for now, is ignored and left to the next scheduled run. plyrix runs the folders that hold the added tracks, every disc of a multi-disc album in one run, or the artist folder when those folders can’t be found. A folder outside music_root is refused. When none of them exists where plyrix sees the library, which is how a wrong lidarr_path_map looks, the hook says so on stderr and queues the album. A drain that runs before the map is fixed can’t find the album either, and moves its file to failed/ in the spool, so fix the map, then move the file back as shown under Never holding up Lidarr.

Lidarr runs the script inside its import and waits for it, so the hook keeps to a time budget, described below.

Route Shim Notes
Lidarr and plyrix in separate containers (recommended) examples/lidarr/lidarr-spool.sh examples/lidarr/compose.lidarr.yaml, a spool folder both containers mount, DRAIN_SCHEDULE, and PLYRIX_LIDARR_PATH_MAP for Lidarr’s /music
Lidarr on the host examples/lidarr/plyrix-hook.sh, or examples/lidarr/plyrix-hook-compose.sh The first runs plyrix installed on the host, the second plyrix’s compose service
plyrix inside Lidarr’s container examples/lidarr/plyrix-hook.sh Needs Python 3.12 or later in the Lidarr image. Not tested end to end

Don’t mount the Docker socket into Lidarr’s container to reach plyrix from there: that hands Lidarr root on the host.

Separate containers. The linuxserver Lidarr image has a shell, but no Python and no docker CLI. So the shim writes each import as one file in a folder both containers mount, and plyrix’s container runs plyrix drain every few minutes.

Terminal window
mkdir -p /srv/plyrix-spool
export LIDARR_SPOOL=/srv/plyrix-spool LIDARR_MUSIC=/music
docker compose -f compose.yaml -f examples/lidarr/compose.lidarr.yaml up -d

Mount the same folder into Lidarr’s container at /plyrix-spool, copy lidarr-spool.sh into Lidarr’s config folder, and set the connection’s Path to it, for example /config/lidarr-spool.sh. Lidarr’s user, its PUID, writes the folder, and plyrix’s CONTAINER_USER reads and removes files in it, so run both as one uid. Don’t share plyrix’s STATE_DIR with Lidarr. The override maps LIDARR_MUSIC onto MUSIC_ROOT in PLYRIX_LIDARR_PATH_MAP, and DRAIN_SCHEDULE defaults to every 5 minutes, so an import waits at most that long.

Lidarr on the host. With plyrix installed on the host, for example with uv tool install plyrix, set Path to plyrix-hook.sh, which runs plyrix lidarr-hook with the settings in Lidarr’s environment or plyrix’s config file. To use plyrix’s compose service instead, set Path to plyrix-hook-compose.sh, and set COMPOSE_FILE to plyrix’s compose.yaml in Lidarr’s environment. It runs docker compose run --pull never --rm --no-deps -T, passing the five Lidarr names through:

  • --pull never stops compose rebuilding plyrix:local on every import, as the service builds its own image.
  • --no-deps doesn’t wait for LRCLIB’s long health check start period.
  • -T, as Lidarr gives the script no terminal.

If plyrix can’t run at all, because it isn’t on Lidarr’s PATH, Docker is stopped, COMPOSE_FILE is unset or the image isn’t built, either shim queues the import in PLYRIX_LIDARR_SPOOL, as lidarr-spool.sh does, and still exits 0. So set PLYRIX_LIDARR_SPOOL in Lidarr’s environment to plyrix’s spool folder, as the host sees it, which is lidarr-spool in STATE_DIR for the compose service, and let Lidarr’s user write it. The compose shim doesn’t pass it into the container. Without it, the shim says so on stderr, and the album waits for the next scheduled run. A Test still exits 1, so Lidarr shows the broken setup.

Where Lidarr sees the library at another path than plyrix does, map it, for example PLYRIX_LIDARR_PATH_MAP='["/music=/srv/music"]'. Schedule plyrix drain as well, so an album the hook queued doesn’t wait for the weekly run. With plyrix on the host, add it to cron:

Terminal window
*/5 * * * * plyrix drain

With plyrix’s compose service, there is no plyrix on the host, so set DRAIN_SCHEDULE where docker compose up -d runs, for example DRAIN_SCHEDULE='*/5 * * * *', and the cron-mode container then drains the queue the hook fills in STATE_DIR.

plyrix inside Lidarr’s container. The linuxserver Lidarr image has no Python, so this needs Python 3.12 or later added to it. LRCLIB has to be reachable from Lidarr’s network too: the shipped compose file publishes LRCLIB on the host’s loopback only, so put Lidarr on plyrix’s compose network and set PLYRIX_LRCLIB_URL=http://lrclib:3300/api. This route was not tested end to end.

The hook exits 0 for every event but a Test with a broken setup, and reports problems in Lidarr’s log, which records a script’s stderr as errors and its stdout at debug level. It works on the album, then on albums queued earlier, for up to lidarr_budget seconds, 60 by default. It checks the budget between tracks, between queued albums, and before each Plex listing and refresh, but never stops a step part way, so the step under way when the budget runs out adds its own time: one track’s LRCLIB lookups, LRCLIB’s readiness check, or a Plex listing of the whole music section, page by page. Each request waits at most 30 seconds, so a server that stops answering can hold the import about that long past the budget, and a slow Plex listing of a large section longer.

When another plyrix run holds the state database, the state database can’t be used, LRCLIB is unavailable, the budget runs out, or the hook stops on an unexpected error before the album has run, the album is queued as one file in lidarr_spool, and Lidarr waits on nothing more. A queued file holds Lidarr’s own paths, so a later drain applies the path map as it is then. Queued albums are run by:

  • the next hook, after its own album, within what is left of its budget;
  • plyrix drain, which removes a file only once its album’s run has finished;
  • a whole-library plyrix run that finishes, which removes the files queued before it started, as it covered them.

A file that can’t be run, because it is corrupt or unreadable, isn’t an import, or names nothing inside music_root, is moved to failed/ in the spool, so it can’t block the queue. Fix the cause, such as lidarr_path_map, then move the files back into the spool as plyrix’s user, and the next drain runs them:

Terminal window
mv /srv/plyrix-state/lidarr-spool/failed/*.event /srv/plyrix-state/lidarr-spool/

The folder is lidarr_spool, which is lidarr-spool beside the state database by default, so lidarr-spool in STATE_DIR for the compose service. A file the drain still can’t run goes back to failed/. A drain that finds music_root missing or empty, as it is while the library is unmounted, runs nothing and moves nothing, so the queue waits for the remount.

Count What it says
queued Albums in the spool when the drain started.
drained Albums run and removed from the spool.
left Albums still queued for the next drain.
quarantined Files moved to failed/.
failed_tracks Tracks in drained albums whose write, file read or LRCLIB lookup failed. The next run tries them again.
Code Meaning
0 A Test whose setup works, and every other event whatever happened: an album that was run, queued or refused, a wrong setting, or a tripwire stop. Problems go to stderr, which Lidarr logs as errors.
1 A Test event found that the settings don’t load, music_root isn’t a folder, or lidarr_spool can’t be written.
2 Lidarr_EventType isn’t set, so Lidarr didn’t run it.
Code Meaning
0 Every queued album was run, nothing was queued, or another plyrix run holds the state database, so the albums wait for the next drain.
1 LRCLIB is unavailable. The albums stay queued.
2 A setting or the state database is wrong, a spool file can’t be removed or moved, failed/ in the spool is a symlink, the spool can’t be listed, or music_root is missing or empty, as an unmounted library is. The albums stay queued.
3 A file was moved to failed/, or tracks in a drained album failed.
4 The drain stopped on an unexpected error. The album it was running and those after it stay queued, so the same error can stop the next drain too; the stderr line names the error.
70 The write tripwire stopped the drain.

With Plex configured, the hook and plyrix drain refresh only the albums in the folders they just ran, paced by plex_pace and within the budget, and print the refresh counts. An album Plex hasn’t scanned yet counts as not_in_plex and stays queued for the next plyrix plex-refresh, as does one the budget left. Without Plex settings, the new sidecars wait in the refresh queue as every sidecar does.

Tested on Lidarr 3.1.0.4875, the linuxserver image, in a scratch instance on 2026-11-10, with sidecars written after Lidarr imported the album, which is how plyrix writes them:

  • Lidarr tracked none of plyrix’s .lrc or .txt files, under the library’s naming or Lidarr’s default naming.
  • A Lidarr rename left every sidecar behind at its old name, in the old folder. plyrix then writes fresh ones beside the renamed tracks, and leaves the old ones where they are.
  • The arr-scripts LyricExtractor script (v1.5, commit c959f71), part of Lidarr Extended, deletes every .lrc in the album folder when it runs, and keeps .txt files. Disable it, or accept that plyrix writes the .lrc again on the next hook, drain or run.
  • Sidecars arriving inside a download were not tested.

Tested end to end on Lidarr 3.1.0.4875 on 2026-11-15, in a throwaway Lidarr with a copied album: Lidarr’s Test passed with a writable spool and failed with an unwritable one, a real import fired lidarr-spool.sh once, plyrix drain then wrote the album’s sidecars and left its audio byte-identical, and with the state database held the hook queued the album and a later drain ran it. That import went through Lidarr’s manual import, as its automatic folder scan didn’t identify the copy within a minute.

Not tested, from Lidarr’s source: Lidarr’s own Import Extra Files setting handles only lyric files that arrive with a download, so it doesn’t pick up plyrix’s later sidecars. A .lrc that does arrive with a download is one plyrix didn’t write, so plyrix leaves it in place, as for any sidecar that isn’t its own. An upgrade whose new file has a different name leaves the old name’s sidecar behind.

The lyrics come from LRCLIB and its contributors. LRCLIBis MIT licensed; plyrix never bundles or mirrors the dump.

plyrix is an independent project, not affiliated with or endorsed by Plex, Inc.