Add the podcast HTTP API for the UI and the web player

/api/podcasts now lists subscriptions with counters and fetch state,
subscribes by feed URL (fetched first; nothing is stored for a URL that
is not a public feed), shows a podcast with its seasons and history,
pages and searches episodes, and runs the explicit progress actions
(start over, played, unplayed) and unsubscribe/subscribe again.

The web player gets two endpoints: playback returns the audio source
and the resume position and, when the browser starts playing, writes a
new listening session as an explicit action above the carried handoff
generation; progress stores checkpoints, pause, stop and handoff at the
session generation, a seek as an explicit action, completes the episode
once at the end or within the completion tail, and records the
listening session. Handlers delegate to podcasts::api, which the new
Postgres test drives directly.

Podcast queue items are no longer marked unavailable in browser JSON
and carry the episode artwork. The temporary dead-code allowance of the
podcast module is gone; helpers used only by tests are cfg(test) and
complete_session gave way to complete_if_current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-20 15:12:38 +02:00
1 parent 5aaea8a8eb
commit 1778942714
13 files changed
+1998 -50

No files matched your search

-2
View File
@@ -1842,7 +1842,6 @@ async fn advance_vector<'e>(
/// Device id of the account's web device, creating the identity on first
/// use. Local podcast actions stamp their operations with it.
#[cfg_attr(not(test), allow(dead_code))] // podcast UI and RSS job: later commits
pub(crate) async fn local_device_id(pool: &sqlx::PgPool, user_id: i64) -> Result<String> {
Ok(ensure_identity(pool, user_id, "").await?.device_id)
}
@@ -1854,7 +1853,6 @@ pub(crate) async fn local_device_id(pool: &sqlx::PgPool, user_id: i64) -> Result
/// `make` receives the `op_id`. The caller applies the returned operation
/// itself in the same transaction, so the log and the materialized state
/// change together (the podcast store does this for its local actions).
#[cfg_attr(not(test), allow(dead_code))] // podcast UI and RSS job: later commits
pub(crate) async fn append_local_op(
conn: &mut sqlx::PgConnection,
user_id: i64,
+1 -1
View File
@@ -365,7 +365,7 @@ async fn podcast_queue_survives_server_browser_server_round_trip() {
assert_eq!(payload["index"], 3);
assert_eq!(payload["position_seconds"], 1200.0);
assert_eq!(tracks[0]["source"]["kind"], "podcast_episode");
assert_eq!(tracks[0]["unavailable"], true);
assert_eq!(tracks[0]["unavailable"], false, "episodes play on the web player");
assert_eq!(tracks[1]["source"]["kind"], "private");
// The browser keeps its queue and sends it back (plus a library track