Convert received playback items without copying wire ids
CI / check (pull_request) Successful in 2m18s
CI / check (pull_request) Successful in 2m18s
Add TrackItem::from_playback_track and PlaybackItem: a received podcast episode becomes TrackItem::podcast_episode (sentinel ids) and a Jam private placeholder gets no TrackItem, so the wire ids (0 for both) are never copied. Narrow the TrackItem::key guidance: it is the source identity, episodes must never be keyed by id, and content-first music matching stays as it is. Document how TrackItem::podcast_episode differs from the wire form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b8d8b532f2
commit
d2530dca6c
6 files changed
+169
-40
No files matched your search
+18
-5
@@ -634,11 +634,24 @@ must keep the same invariants.
|
||||
decoded; it only keeps music-only code that predates podcasts
|
||||
(`id >= 0`, `release_id < 0` checks) from taking an episode for library
|
||||
track, release or artist 0. There is no reserved range of negative ids.
|
||||
* Clients key queue items, the current track and position matching by
|
||||
`TrackItem::key` (a typed `TrackItemKey`; string form `lib:<id>`,
|
||||
`fed:<owner>:<item_id>`, `ep:<episode id>`), and on the wire by
|
||||
`PlaybackSource`, never by the numeric id. Keying by id (for example a
|
||||
`local:{id}` string) would merge all episodes into one.
|
||||
* `TrackItem::key` (a typed `TrackItemKey`; string form `lib:<id>`,
|
||||
`fed:<owner>:<item_id>`, `ep:<episode id>`) is the source identity of a
|
||||
queue item; on the wire it is `PlaybackSource`. An episode is identified
|
||||
by `TrackItem.podcast` / `ep:` only and must never be keyed by its numeric
|
||||
id: keying by id (for example a `local:{id}` string) would merge all
|
||||
episodes into one. `TrackItemKey` has no content-id equivalence (a pending
|
||||
federated item and its imported library copy differ), so clients that
|
||||
match music content-first keep doing that and add the podcast branch
|
||||
before any fallback to the id.
|
||||
* Wire ids of podcast items and of Jam private placeholders are `0`
|
||||
(`PlaybackTrack::podcast_episode`, `PlaybackTrack::private_placeholder`)
|
||||
and must not be copied into a `TrackItem`.
|
||||
`TrackItem::from_playback_track` classifies a received item as
|
||||
`PlaybackItem::Music` (the client's music path), `PodcastEpisode` (built
|
||||
with `TrackItem::podcast_episode`, sentinel ids) or `Private` (not
|
||||
playable, no `TrackItem`). Besides the ids, `TrackItem::podcast_episode`
|
||||
also differs from the wire form in `release_year` (publication year) and
|
||||
`audio_format` (`None`; the MIME type stays in the reference).
|
||||
|
||||
## Versioning
|
||||
|
||||
|
||||
Reference in new issue
Block a user