Key podcast queue items by source, not by a negative id range

The per-episode negative ids (TrackItem::podcast_track_id below
PODCAST_TRACK_ID_MAX) were a magic id range in shared code, which the
podcast requirements forbid. Podcast items now use the fixed sentinel
TrackItem::NOT_A_LIBRARY_ROW (-1) as id, release_id and artist id; it
carries no identity. Their identity is TrackItem.podcast alone.

Add TrackItem::key returning a typed TrackItemKey (library row, federated
owner and item id, podcast episode id, or transient), with the stable
string forms lib:<id>, fed:<owner>:<item_id>, ep:<episode id> and
tmp:<id>, so clients key queue items by source instead of by numeric id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-19 18:04:37 +02:00
1 parent 9709f5e2b5
commit 06ac3691d8
6 files changed
+276 -63

No files matched your search

+6 -2
View File
@@ -53,8 +53,12 @@ converges independently of delivery order. Migrations follow
`PRAGMA user_version`; the prototype podcast database is imported and its
tables are kept as `legacy_*`; newer or foreign files are refused unchanged.
`TrackItem.podcast` marks episode queue items, which music-only code must
skip; their negative ids (`release_id` and artist id -1) keep code written
for library tracks (`id >= 0`) away from them. See the "SQLite reference store" section of [PODCASTS.md](PODCASTS.md).
skip. Queue items are keyed by `TrackItem::key` (a typed `TrackItemKey`:
library row, federated owner and item id, or episode id), never by the
numeric id: episodes use the fixed sentinel id, `release_id` and artist id
-1, which carries no identity and only keeps code written for library
tracks (`id >= 0`) away from them. See the "SQLite reference store" section
of [PODCASTS.md](PODCASTS.md).
Filesystem scanning schedules, playback, federation lifecycle, and UI state
remain application responsibilities. Database and metadata work must stay off