Script the Jellyfin library retirement

Matches libraries by path, never by name, and reads the name to delete back
from the API rather than assuming it: the endpoint takes a name, matches
loosely on some versions, and "YouTube" is a prefix of "YouTube (stream)".
Refuses to retire the old library unless ytstream's has episodes, so a
broken replacement cannot leave the server with no YouTube library. Dry run
by default.

Also records that /opt/youtube-automate is verified fully pushed to its bare
repo -- clean tree, specs.md tracked -- so it is safe to delete, while
/var/lib/youtube-automate holds subs.db, which is state and not in the repo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-13 11:00:47 +01:00
parent c7a80d200e
commit 89c3644d57
2 changed files with 187 additions and 0 deletions
+24
View File
@@ -1201,3 +1201,27 @@ Not scripted, because each destroys something:
and the constant can stay as it is.
* **`/disks/Plex/YouTube`** (§12.6), 2.0 GB.
* **`/opt/youtube-automate`, its repo, `subs.db`, `specs.md`** — keep (§12.7).
### §12.3 is scripted now, and §12.7 changed
`deploy/retire-jellyfin-library.py` does the Jellyfin step. It matches libraries by
**path, never by name**, and reads the name to delete back from the API instead of
assuming it — the delete endpoint takes a name, matches loosely on some versions,
and `YouTube` is a prefix of `YouTube (stream)`. It refuses to retire the old
library unless ytstream's has episodes, because doing it with a broken replacement
leaves no YouTube library at all. Dry run by default; `--yes` applies.
What it costs, stated in the script itself: Jellyfin's watch history and resume
positions for the deleted library go with it. The files do not.
**§12.7 revised — `/opt/youtube-automate` can go after all.** Verified 2026-08-13:
the working tree is clean, everything is pushed to
`/disks/git-repos/youtube-automate.git` (612 KB), and both `specs.md` and
`specs.handover-original.md` are tracked, so the reference material survives in the
bare repo. Nothing in ytstream's code references the old tree — only comments and
`decommission.sh`, which names the *service*.
Still worth keeping out of `rm`: `/var/lib/youtube-automate` (170 MB) holds the old
venv and `subs.db`, and `subs.db` is *not* in the repo — it is state, not code. It is
already copied to `/var/lib/ytstream/youtube-automate-subs.db.archived-20260813`, so
that directory is now safe to delete too, just not before checking that copy exists.