Files
serverAppConfigs/serverAppConfigs-docs/Dankserver/Media Audiobook Relayout.md
T
Frank b7f4b7e148 docs(audiobookshelf): one page for the endpoint, and the rescan law at the relayout
The page owns the shape, the first-run account step (ABS accepts the initial
account only from a local-network address) and the laws: why the array bind is
read-only and what the one-line rollback is if on-disk sidecars are ever wanted;
why the metadata view is not that rollback; why the mount gate, the wget health
check and the amd64 digest pin are each mandatory; and that LAN-only is a posture,
not an accident.

Media Audiobook Relayout gains the third reader: ABS stores absolute paths, so the
relayout procedure has to reach its library too or it keeps rows for folders that
are gone. The vault index is regenerated, not hand-carved.
2026-11-02 02:19:29 -08:00

4.1 KiB

type, title, description, tags, timestamp
type title description tags timestamp
reference Media Audiobook Relayout Re-filing /mnt/entropy/Audiobooks by Plex's chapter rows: narrator shelves, no renumbering, the refusals.
dankserver
media-server
plex
media-relayout
2026-10-31T00:00:00Z

Media Audiobook Relayout

/mnt/entropy/Audiobooks is the one library here that Jellyfin does not read at all — its music scanner has no audiobook concept — while Plex indexes all of it as Artist → Album → Track: the album is the BOOK, that book's single artist is the NARRATOR, both matched out of the files' own tags. Audiobookshelf streams the same tree, read-only, and owns nothing in it. Today one book is split across … [Part 1], … [Part 2] folders three or four deep inside a collection pack, so a scan serves three quarters of a novel; scripts/media-audiobooks.py re-files the tree so the property both servers' book scanners assume is true —

Audiobooks/<Narrator>/<Book> (<year>)/<the file keeps its own name>

The shared gates, the executor, the journal law and the rollback live in Media Relayout; this page is the audiobook arm only.

# 1. The authority: Plex's chapter rows for this root (the DB opens read-only).
python3 scripts/media-census.py audiobooks --root /mnt/entropy/Audiobooks \
    --out /tmp/ab_rows.tsv
# 2. What is on disk (stat only).
python3 scripts/media-census.py enumerate --root /mnt/entropy/Audiobooks \
    --out /tmp/ab_enum.tsv
# 3. The plan.
python3 scripts/media-audiobooks.py --root /mnt/entropy/Audiobooks \
    --enum /tmp/ab_enum.tsv --rows /tmp/ab_rows.tsv --out /tmp/ab_plan.tsv \
    --exceptions /tmp/ab_exceptions.txt
# 4. Read the exceptions file FIRST. Then the same executor, journal and rollback
#    as [[Media Relayout]] shows, on its own journal, and refresh the Plex section
#    as in step 5 of the movie Procedure — from inside the container, never over
#    the host port.
#    Audiobookshelf stores absolute paths, so the same refresh has to reach its
#    library too ([[Audiobookshelf]]) — otherwise it keeps rows for folders that
#    no longer exist.
scripts/media-apply.py apply --plan /tmp/ab_plan.tsv --root /mnt/entropy \
    --journal /mnt/entropy/media-relayout-audiobooks.jsonl --apply

The group is the identity Plex asserts in its own database — (narrator, book, year) — so one book arriving in four part folders becomes one folder, and a 1965 and a 2020 recording that share a title stay two books.

Two laws are forced by what the rows actually hold:

+- A chapter is never renumbered. Most books contain chapters whose index Plex does not know, so a number written into a name would be invented — and it would buy nothing, because both servers order playback by the embedded track tag, not by the file name. A wrong number in a name is the number a human later trusts. Fix order in the tags: a Plex scan re-reads tags and never renames a file. +- The shelf is the narrator, not the author. Every book has exactly one artist row and it is the narrator; the author survives only inside some album titles (Kryptos by Graham McNeill) and in no column Plex stores, so deriving it would mean parsing titles where a ripper wrote one and inventing it everywhere else. The author stays visible in the folder name Plex itself shows.

What it refuses, the music arm's list with one addition: a video container, audio no chapter row names, and a loose file in a folder holding two books all park under _unsorted with the path they have today — and so does a chapter whose row names no book or no narrator: a placeholder ([Unknown Album], [Unknown Artist]) that unrelated books share, or a chapter number mistagged as the artist (0.4). Various Artists is not a placeholder — that is a multi-cast read.

The reviewed plan lives at /mnt/entropy/media-relayout-audiobooks-plan.tsv; it applies on its own journal, behind the music writer, and then refreshes the Plex section. Verify it with --db-kind plex — Jellyfin holds no rows here, so a Jellyfin pass proves nothing either way.

See Also

Media Relayout, Media Music Relayout, Plex