Skip to content

Keeping LRCLIB current

LRCLIB publishes whole dumps at irregular times, each about 49 GB (the dump of 2026-10-30, measured 2026-11-11, was 49.3 GB), and no diff between them. scripts/lrclib-update.sh keeps a local LRCLIB on the newest one. Each run checks the listing LRCLIB’s own db-dumps page reads, which is one small request. Only when that names a dump newer than the one LRCLIB serves does it read the first 64 KB of that dump, to check its SQLite version and its exact decompressed size. Only then does it:

  1. check the room with plyrix doctor;
  2. download the dump with resume, as the setup script does;
  3. decompress it beside the live database, which LRCLIB keeps serving;
  4. verify it read-only with plyrix lrclib-verify;
  5. record what changed with plyrix lrclib-diff, as ids and hashes;
  6. swap it in, journaled, wait for LRCLIB, and record the dump live with plyrix lrclib-record.

A day with no newer dump costs that one request and downloads nothing.

The schedule belongs to the host, because the script stops and starts LRCLIB with the host user’s own compose rights and renames LRCLIB’s files. plyrix itself starts and stops nothing, and no container gets Docker’s socket. Copy examples/systemd/plyrix-lrclib-update.service and examples/systemd/plyrix-lrclib-update.timer to ~/.config/systemd/user/, set the service’s Environment lines, and run systemctl --user enable --now plyrix-lrclib-update.timer. The timer runs daily. A cron line does the same:

Terminal window
@daily cd /srv/src/plyrix && LRCLIB_DATA=/srv/lrclib LRCLIB_FOLLOW_UP=1 scripts/lrclib-update.sh

With the container, set PLYRIX="docker compose -f /srv/src/plyrix/compose.yaml run --rm --no-deps plyrix", with MUSIC_ROOT and STATE_DIR set as for compose. --no-deps matters, as LRCLIB is down for part of a swap.

“Never touches the music library” holds for the update steps: none of them opens a file in the library. The follow-up below, when it is on, is plyrix’s normal scan, under the same write tripwire as any run.

What What happens
Not enough room for the download, the decompressed database and its search index doctor stops the update before anything is fetched
A dump too new for the pinned LRCLIB build, whose user_version is outside 1 to 8 Refused before the download. Move the LRCLIB pin in compose.yaml to load it.
A staged database that fails its checks: tables, columns, the index the diff reads, or SQLite’s quick_check Refused, deleted, and LRCLIB is never stopped
LRCLIB doesn’t stop Nothing changes
LRCLIB doesn’t start, or doesn’t answer /api/get or search in time Rolled back: the old database, its WAL and its search index are put back, and LRCLIB is started on them
The script is killed, or the host reboots, part way The next run finishes or undoes the swap first, from its journal. A staged database left from before the swap began is removed first, so it doesn’t hold the space the next update needs

A refused or rolled back dump isn’t tried again by itself; LRCLIB_UPDATE_RETRY=1 tries it once more. Its download is kept, so a retry needs no second download. Two updates never overlap, and the setup script takes the same lock.

These are the script’s own, read from its environment. The setup script reads the same ones where they apply.

Variable Meaning Default
LRCLIB_DATA LRCLIB’s data folder required
PLYRIX The plyrix command, configured as for a run plyrix
LRCLIB_DUMP_LISTING The dump listing the one LRCLIB’s db-dumps page reads
LRCLIB_DUMP_BASE Where dumps are fetched from https://db-dumps.lrclib.net
LRCLIB_STOP The command that stops LRCLIB docker compose stop lrclib
LRCLIB_START The command that starts LRCLIB docker compose up -d --no-build lrclib
LRCLIB_URL LRCLIB’s API, for the readiness waits http://127.0.0.1:3300/api
LRCLIB_PORT The loopback port LRCLIB is published on 3300
LRCLIB_USER uid:gid LRCLIB runs as, passed to compose 1000:1000
LRCLIB_DOWNLOAD_RETRIES Download attempts in a row that add no bytes before giving up 10
LRCLIB_RETRY_SECONDS The first wait between download attempts 5
LRCLIB_READY_TIMEOUT Seconds to wait for the search index after a swap 43200
LRCLIB_GET_TIMEOUT Seconds to wait for /api/get after a swap 600
LRCLIB_POLL_SECONDS Seconds between readiness polls 30
LRCLIB_QUICK_CHECK 1 runs SQLite’s quick_check on the staged database, which reads all of it; 0 skips it 1
LRCLIB_UPDATE_RETRY 1 tries a refused or rolled back dump again 0
LRCLIB_KEEP_PREVIOUS_DAYS Days to keep the previous database after a swap 0, deleted once the new dump is live
LRCLIB_KEEP_DOWNLOAD 1 keeps the download once the new dump is live 0
LRCLIB_STATE_WAIT Seconds to wait while another plyrix run holds the state database 43200
LRCLIB_FOLLOW_UP 1 runs the scan and a capped Plex refresh after a new dump goes live 0
LRCLIB_PLEX_LIMIT The most album refreshes that follow-up sends 100
Code Meaning
0 No newer dump, or the new dump is live.
1 A check, download, verify, diff or swap failed, or the dump was refused or rolled back.
2 A setting or argument is wrong, or doctor’s exit 2.
3 The new dump is live, but the follow-up run or Plex refresh didn’t finish; the next scheduled run does it.
75 Another update or plyrix run was busy, so nothing was done, and the next run tries again.

The next plyrix run looks up an earlier miss or a .txt again only when the diff holds a record by its artist or with its title, when the track was released in or after the old dump’s year, or when it was added after the old dump’s date. A .txt that now finds synced lyrics becomes a .lrc. Everything else keeps its result and moves to the new dump without a lookup, since the diff shows its record didn’t change, so a row’s dump means the dump it is current against, not the one that first answered it. plyrix run --full looks up every earlier miss and .txt again, whatever the diff says.

The first update after upgrading plyrix looks up every earlier miss, as older ledger rows hold no keys yet. That is expected, and costs what an update cost before.

LRCLIB rebuilds its search index after a swap, which took about 10 minutes as measured on one host in 2026-11. A run in that window stops with nothing recorded, and the next one does the work.

With LRCLIB_FOLLOW_UP=1, as the example unit and the cron line above set, the update runs that scan itself right after a new dump goes live. It then runs plyrix plex-refresh --limit with LRCLIB_PLEX_LIMIT, even when the scan didn’t finish every track, paced by plex_pace, and the albums over the cap wait for the next refresh. With it off, the next scheduled run and refresh do the same work; add --limit N to that refresh to cap a large burst.

The dump has no published checksum or signature. The gzip check, SQLite’s quick_check, the schema and index checks and the version guard are what the script relies on instead, over TLS.

On 2026-11-15 the update, the rollback and the refusal were run end to end against the pinned LRCLIB build, with an invented database, by the opt-in gate in tests/gates/test_lrclib_update_gate.py.

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.