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>
A provisional imported GUID-less episode whose feed item id is already
held by an episode that stays (typically one a remote operation created
before this device's first refresh) is now deleted instead of kept as a
second, never re-keyed copy. The same applies when its legacy GUID turns
out to be the item's real GUID. Such episodes carry no personal state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
The prototype kept one row per enclosure URL for GUID-less items, so stale
rows could change which identity key is unique and give imported episodes
ids a fresh device never derives. The import now collapses rows of one item
seen under several enclosure URLs, and the first refresh re-keys imported
GUID-less episodes without progress or sessions to the ids the current feed
gives.
Fetch-state writes read and write the row under one lock and one immediate
transaction, so concurrent writers no longer lose columns or failure counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TrackItem::podcast_episode used id 0, release_id 0 and artist id 0, which
clients treat as library rows. Podcast items now get a negative id derived
from the episode id (TrackItem::podcast_track_id, at most
PODCAST_TRACK_ID_MAX, below pending federated ids) and release/artist id -1,
so existing id < 0 / release_id < 0 checks skip them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PODCASTS.md gains the "SQLite reference store" section (migrations,
prototype import, tables, invariants); ARCHITECTURE.md, the
furumi-library README and the changelog describe PodcastStore and
TrackItem.podcast.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New `furumi_library::podcasts::PodcastStore` in its own podcasts.sqlite3:
- user_version migrations in immediate transactions; version 1 is the
prototype schema of the original podcast PR, version 2 renames its tables
to legacy_* and imports feeds, episodes and fetch state with contract
ids; unimportable rows go to legacy_quarantine; newer or foreign files
are refused before anything is written;
- catalog (podcasts, feed aliases, seasons, episodes), subscription, share
and progress registers, listening sessions and local-only fetch state;
- local actions that apply and return podcast sync operations, remote
operation and snapshot application through the music-dht materializers
and merge functions, bounded snapshot export;
- RSS refresh ingestion with stable episode ids and alias learning that
never touches personal state, and queries for the UI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TrackItem gains `podcast: Option<PodcastEpisodeRef>` with
`TrackItem::podcast_episode`, `is_podcast` and `podcast_episode_ref`.
Library queries keep returning music only (`podcast: None`); the library
database is unchanged. Music-only code paths must check `is_podcast`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>