Skip to content

Plex

A Plex library scan doesn’t attach new sidecars, but an album metadata refresh does. plyrix plex-refresh asks your local Plex Media Server to refresh each album that gained or changed a sidecar, one album per request, waiting plex_pace seconds after each.

Terminal window
export PLYRIX_PLEX_URL=http://localhost:32400 PLYRIX_PLEX_SECTION=1
export PLYRIX_PLEX_TOKEN=... # or a secret file, see Settings
uv run plyrix plex-refresh --dry-run
uv run plyrix plex-refresh --limit 50
uv run plyrix plex-refresh

Tested on PMS 1.43.4.10903, 2026-11-10 and 2026-11-11:

  • Synced lyrics from a local .lrc scrolled in Plexamp, with the first line shown.
  • A library scan does not attach a new sidecar; an album metadata refresh does, within about 30 s.
  • plyrix’s hidden temp files are ignored.
  • An empty .lrc attaches with no timing; replaced in place, it keeps its stream and serves the timed text after a refresh.
  • An .lrc without timestamps attaches but isn’t timed, which is why plain lyrics go to .txt.
  • With both .lrc and .txt, Plex lists both, the .lrc timed. Deleting a sidecar and refreshing removes its stream.

plyrix run never contacts Plex. The refresh is a separate step, which a scheduler runs after each run. While one of them holds the state database, the other waits its turn by stopping with exit code 75. With no plex_url set, plex-refresh says so and exits 0, so the step can stay in a schedule.

Every sidecar a run writes or adopts is queued for a refresh, and stays queued until Plex accepts the refresh of its own track’s album, or of every album in its folder if Plex lists no track of that name there. A run or a refresh that is interrupted loses nothing: what is still queued is refreshed next time. A folder Plex doesn’t list yet, perhaps because Plex hasn’t scanned it, stays queued and counts as not_in_plex. A large not_in_plex usually means plex_music_root doesn’t match the path Plex sees for the library. plyrix compares its paths with Plex’s as POSIX paths, byte for byte.

Before a first refresh of a large backlog, run it with --dry-run, which sends nothing and changes nothing, and prints how many albums it would refresh. Then use --limit N to send at most N album refreshes per drain. A sidecar whose albums don’t fit in what is left of the limit stays queued for the next drain, and the drain moves on to the next one, so each drain makes progress.

Count What it says
queued_sidecars, queued_folders Sidecars waiting for a refresh, and the folders they are in.
albums_to_refresh The albums this drain sends, or a dry run would send, within --limit.
refreshed, refresh_failed Album refreshes Plex accepted, and ones it refused or failed.
cleared_folders, cleared_sidecars Folders with no sidecar still queued, and sidecars no longer queued, because Plex accepted the albums they need.
not_in_plex Queued folders Plex doesn’t list. They stay queued.
outside_root Queued folders outside the music root, which plyrix can’t map to Plex’s path. They stay queued.
left_by_limit Queued folders with a sidecar left for the next drain by --limit, or by the Lidarr hook’s time budget.

--report FILE writes these counts to a JSON file, with command set to plex-refresh and end_reason set to finished or plex_unavailable. Only the flag writes one, so the report_file setting stays the run’s. Like the run’s report, it holds no paths and no titles, and it never holds plex_url or the token.

Code Meaning
0 Every album sent was refreshed, or nothing was queued. Folders Plex doesn’t list don’t change this.
1 Plex didn’t answer, or refused the token, before anything was sent, so nothing was refreshed.
2 A setting is wrong, or plex_section isn’t a music library on that server.
3 Plex refused or failed at least one album refresh. Those folders stay queued, and a refused one names plex_token. The drain stops at the first refusal, or after three failures in a row, and leaves the rest queued.
75 Another plyrix run is using the state database.

Plex accepting a refresh doesn’t prove it attached the sidecar. plyrix plex-check asks Plex what it attached for a sample of sidecars, 10 by default, picked at random from those whose album refresh Plex already accepted. --sample N checks N instead. A PATH checks one track, one sidecar, or every published sidecar in an album folder, whether or not its refresh is still queued.

Terminal window
uv run plyrix plex-check
uv run plyrix plex-check --sample 50 --verbose
uv run plyrix plex-check "$PLYRIX_MUSIC_ROOT/Artist/Album"

Each sidecar gets one verdict:

Verdict What Plex shows Passes for
local_timed A lyric stream from the sidecar, which Plex says is timed. .lrc
local_untimed A lyric stream from the sidecar, which Plex says isn’t timed, or doesn’t say. .txt
provider Lyrics from an online provider only, not from the sidecar. neither
none No lyrics, or no track for the sidecar. neither

A .lrc passes only when Plex lists a lyric stream from the sidecar itself and says that stream is timed. Lyrics from an online provider don’t count, even timed ones. A .txt passes as local_untimed.

Plex refreshes an album in the background after it accepts the request, so a check straight after a drain can fail and pass a few minutes later. plyrix never queues a sidecar again after a failed check, and a check changes nothing in the state database. To learn whether a stream is timed, the check reads Plex’s lyric stream, which holds the lyrics, and keeps nothing from it but that one flag. No lyrics or titles appear in its output or its report.

Count What it says
checked, passed, failed Sidecars checked, and whether each got the verdict its kind should.
local_timed, local_untimed, provider, none Sidecars with each verdict.
not_in_plex Sidecars counted as none because Plex doesn’t list their track.
unreadable Sidecars counted as local_untimed because Plex’s stream body didn’t say whether it is timed, or the stream was gone. A stream request Plex fails or refuses stops the check with exit code 1 instead.

--verbose also prints each sidecar’s path, relative to the music root, and its verdict. --report FILE writes the counts as plex-refresh does, with command set to plex-check. Unlike plex-refresh, plex-check stops with exit code 2 when plex_url isn’t set, as the check was asked for.

Code Meaning
0 Every sidecar checked passed, or none has had its album refreshed yet.
1 Plex didn’t answer, or refused the token, so the check is incomplete.
2 A setting is wrong, plex_section isn’t a music library, or no sidecar is published at the PATH given.
3 At least one sidecar didn’t get the verdict its kind should. Nothing is queued again.
75 Another plyrix run is using the state database.

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.