podcasts: the Podcast Index id is PodcastIndexFeedId, and the RSS URL is kept

A subscription stored the feed's Podcast Index id in a property named
PodcastFeedRssUrl, and the search result's real RSS URL was dropped. The
id now lives in PodcastIndexFeedId, named for what it holds, and
PodcastFeedRssUrl holds the URL — written at subscribe on desktop and
Android from the search result, and read back as PodcastFeed::rss_url /
PodcastItem.rss_url. Nothing fetches from it yet; it is the publisher's
own address for the feed, which reading feeds without the directory
(docs/rss-reader.md phase 6) would need.

Not converted in place: a store holding feeds from before this change
reads their old id as an RSS URL, and is recreated rather than migrated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Greg ShuflinandClaude Opus 5.5 committed 2026-10-03 20:07:12 -07:00
1 parent 4ba394af1d
commit 3820d4e81b
12 files changed
+63 -24

No files matched your search

@@ -12,6 +12,8 @@ data class Podcast(
val coverArtUri: Uri?,
val coverArtBytes: ByteArray? = null,
val lastUpdated: Instant = Instant.now(),
/** The feed's RSS URL, as the Podcast Index reported it; `null` when unknown. */
val rssUrl: String? = null,
/**
* The playback rate the user chose for this show (`1.25` for 1.25x), or `null` to play at the
* default. Persisted per feed and synced, so a rate set on one node is the rate the next
@@ -155,6 +155,7 @@ class PodcastRepository {
// store answers "when did this feed last change", so a fresh stamp per reload would
// only make every row claim it changed just now.
lastUpdated = carried?.lastUpdated ?: Instant.now(),
rssUrl = item.rssUrl,
customSpeed = item.customSpeed,
)
}
@@ -506,6 +507,7 @@ class PodcastRepository {
author = podcast.author,
coverArtUri = coverArtUri,
lastUpdated = podcast.lastUpdated.toString(),
rssUrl = podcast.rssUrl,
)
}
.getOrElse { e ->
@@ -57,6 +57,7 @@ private fun SearchResults(
lastUpdated =
result.lastUpdateTime?.let { Instant.ofEpochSecond(it) }
?: Instant.now(),
rssUrl = result.url.takeIf { it.isNotEmpty() },
)
)
}
+7 -13
View File
@@ -41,16 +41,10 @@ wrong, and the plan depends on knowing that up front.
`rust/lib/src/agents/podcast.rs` never parses a feed. It calls the **Podcast
Index JSON API** (`api.podcastindex.org`, SHA-1 request signing, search by term
and episodes by feed id) and deserializes JSON with serde. The property named
`PropertyKind::PodcastFeedRssUrl` does not hold an RSS URL — it holds the
Podcast Index numeric feed id stringified, as `gui-app/src/agents/podcasts/mod.rs`
admits in a comment on the subscribe path:
```rust
// The Podcast Index id is stored as the feed's "RSS URL" for now — it's the
// key we match on to tell whether a feed is already subscribed.
write(PropertyKind::PodcastFeedRssUrl, PropertyValue::Text(meta.id.to_string()))?;
```
and episodes by feed id) and deserializes JSON with serde. A subscription is
keyed by `PropertyKind::PodcastIndexFeedId`, the directory's numeric feed id;
`PropertyKind::PodcastFeedRssUrl` holds the feed's real RSS URL as the
directory reported it at subscribe time, but nothing reads the feed from it.
There is no XML feed parsing anywhere in the workspace. `quick-xml` is a
dependency, but its only use is `ComicInfo.xml` inside `agents/comics.rs`.
@@ -69,8 +63,8 @@ So the reuse is real but it is *not* the parser:
**The reuse direction is inverted from what the premise suggests.** We build a
real feed fetch/parse module for the reader, and the *podcast* agent is the
candidate to adopt it later (phase 6), which would also let
`PodcastFeedRssUrl` finally hold a URL.
candidate to adopt it later (phase 6), reading the `PodcastFeedRssUrl` it
already stores.
---
@@ -687,7 +681,7 @@ every commit.
| **3** | `JobKind::FeedRefresh`, `refresh_due_feeds`, the refresh-interval setting, conditional GET, retention, the duplicate-feed dedup pass. | tests + Jobs screen shows refresh jobs |
| **4** | Android: FFI surface + `FeedsScreen`/ViewModel + registry wiring. | `just gradlew build` where the toolchain exists |
| **5** | OPML import/export, folders (`Collection` parents), feed icons as `Thumbnail` blobs, per-feed refresh override. | tests + visual |
| **6** | *Optional, separable:* point the podcast agent's feed handling at `agents::feeds::parse`, so `PodcastFeedRssUrl` holds a real URL and podcasts work for feeds Podcast Index doesn't index. | existing podcast tests + visual |
| **6** | *Optional, separable:* point the podcast agent's feed handling at `agents::feeds::parse`, reading the stored `PodcastFeedRssUrl`, so podcasts work for feeds Podcast Index doesn't index. | existing podcast tests + visual |
Phases 0–2 are the useful minimum: a working single-node reader. Phase 3 is what
makes it pleasant, phase 4 what makes it an ensemble feature in practice.
+4 -2
View File
@@ -97,6 +97,8 @@ pub struct PodcastMeta {
pub image: Option<String>,
/// Feed's last-update time as Unix epoch seconds, if known.
pub last_update_time: Option<i64>,
/// The feed's RSS URL, if known.
pub rss_url: Option<String>,
/// The user's preferred playback speed for this podcast's episodes, if
/// they've set one. `None` until subscribed and a speed has been chosen.
pub custom_speed: Option<f32>,
@@ -427,9 +429,8 @@ fn podcast_glyph(color: Rgba, glyph: Pixels) -> AnyElement {
/// the background executor.
pub(crate) fn subscribe(store: &Store, node: NodePubkey, meta: &PodcastMeta) -> Result<(), String> {
let feed = podcast::NewFeed {
// The Podcast Index id is stored as the feed's "RSS URL" for now — it's
// the key we match on to tell whether a feed is already subscribed.
api_id: meta.id.to_string(),
rss_url: meta.rss_url.clone(),
title: meta.title.clone(),
description: meta.description.clone(),
author: meta.author.clone(),
@@ -485,6 +486,7 @@ pub(crate) fn load_subscriptions(store: &Store) -> Vec<PodcastMeta> {
description: feed.description,
image: feed.cover_art_url,
last_update_time: feed.last_fetched_at,
rss_url: feed.rss_url,
custom_speed: feed.custom_speed,
})
})
@@ -56,6 +56,8 @@ struct SearchResult {
image: Option<SharedString>,
/// Feed's last-update time as Unix epoch seconds, if known.
last_update_time: Option<i64>,
/// The feed's RSS URL, as the index reports it.
rss_url: String,
}
impl SearchResult {
@@ -68,6 +70,7 @@ impl SearchResult {
description: self.description.to_string(),
image: self.image.as_ref().map(ToString::to_string),
last_update_time: self.last_update_time,
rss_url: Some(self.rss_url.clone()).filter(|url| !url.is_empty()),
// Not subscribed yet (or not looked up here even if it is) — the
// detail screen refreshes from the stored subscription separately.
custom_speed: None,
@@ -223,6 +226,7 @@ impl PodcastSearchView {
.filter(|url| !url.trim().is_empty())
.map(Into::into),
last_update_time: feed.last_update_time,
rss_url: feed.url,
})
.collect();
// Reflect which of the new results are already subscribed.
+29 -8
View File
@@ -80,11 +80,12 @@ pub enum PodcastError {
pub struct PodcastFeed {
/// The feed's document id.
pub document_id: DocumentID,
/// Raw `PodcastFeedRssUrl` property — currently the Podcast Index feed id
/// stored as a string. Empty when unset.
/// The `PodcastIndexFeedId` property as stored. Empty when unset.
pub api_id: String,
/// `api_id` parsed as a Podcast Index numeric feed id, when it is one.
pub podcast_index_id: Option<i64>,
/// The feed's RSS URL, if it was known at subscribe time.
pub rss_url: Option<String>,
pub title: String,
pub author: String,
pub description: String,
@@ -117,6 +118,7 @@ pub fn list_podcast_feeds(store: &Store) -> Result<Vec<PodcastFeed>, DocumentSto
document_id: doc.id.clone(),
api_id: String::new(),
podcast_index_id: None,
rss_url: None,
title: String::new(),
author: String::new(),
description: String::new(),
@@ -126,10 +128,13 @@ pub fn list_podcast_feeds(store: &Store) -> Result<Vec<PodcastFeed>, DocumentSto
};
for p in props_by_doc.get(&doc.id).into_iter().flatten() {
match (&p.kind, &p.value) {
(PropertyKind::PodcastFeedRssUrl, PropertyValue::Text(s)) => {
(PropertyKind::PodcastIndexFeedId, PropertyValue::Text(s)) => {
feed.api_id = s.clone();
feed.podcast_index_id = s.parse::<i64>().ok();
}
(PropertyKind::PodcastFeedRssUrl, PropertyValue::Text(s)) if !s.is_empty() => {
feed.rss_url = Some(s.clone())
}
(PropertyKind::Title, PropertyValue::Text(s)) => feed.title = s.clone(),
(PropertyKind::PodcastFeedDescription, PropertyValue::Text(s)) => {
feed.description = s.clone()
@@ -183,8 +188,10 @@ pub fn find_feed_by_index_id(
/// from the Podcast Index API); an unparseable one arrives here as `None`.
#[derive(Clone, Debug)]
pub struct NewFeed {
/// Podcast Index feed id, stored as `PodcastFeedRssUrl`.
/// Podcast Index feed id, stored as `PodcastIndexFeedId`.
pub api_id: String,
/// The feed's RSS URL. Written only when `Some` and non-empty.
pub rss_url: Option<String>,
pub title: String,
/// Written only when non-empty, so an absent value leaves no property row.
pub description: String,
@@ -213,7 +220,10 @@ pub fn subscribe(
let write = |kind, value| store.doc_store.set_property(tx, &doc_id, kind, value, node);
write(PropertyKind::PodcastFeedRssUrl, PropertyValue::Text(feed.api_id.clone()))?;
write(PropertyKind::PodcastIndexFeedId, PropertyValue::Text(feed.api_id.clone()))?;
if let Some(url) = feed.rss_url.as_ref().filter(|s| !s.is_empty()) {
write(PropertyKind::PodcastFeedRssUrl, PropertyValue::Text(url.clone()))?;
}
write(PropertyKind::Title, PropertyValue::Text(feed.title.clone()))?;
if !feed.description.is_empty() {
write(
@@ -760,7 +770,8 @@ pub struct PodcastSearchResult {
/// [`PodcastFeed::api_id`]) and what [`get_podcast_episodes`] takes.
pub id: i64,
pub title: String,
/// The feed's RSS URL. Not stored at subscribe time today.
/// The feed's RSS URL — stored at subscribe time as
/// [`PodcastFeed::rss_url`].
pub url: String,
pub description: String,
pub author: String,
@@ -940,7 +951,12 @@ mod tests {
let full = Document::new(DocumentType::PodcastFeed, None, node);
let full_id = full.id.clone();
add_document(&store.doc_store, full);
write(&full_id, PropertyKind::PodcastFeedRssUrl, PropertyValue::Text("550168".into()));
write(&full_id, PropertyKind::PodcastIndexFeedId, PropertyValue::Text("550168".into()));
write(
&full_id,
PropertyKind::PodcastFeedRssUrl,
PropertyValue::Text("https://feeds.example/jre.xml".into()),
);
write(&full_id, PropertyKind::Title, PropertyValue::Text("Joe Rogan".into()));
write(&full_id, PropertyKind::PodcastFeedAuthor, PropertyValue::Text("Joe".into()));
write(&full_id, PropertyKind::PodcastFeedDescription, PropertyValue::Text("Talk".into()));
@@ -964,7 +980,7 @@ mod tests {
add_document(&store.doc_store, sparse);
write(
&sparse_id,
PropertyKind::PodcastFeedRssUrl,
PropertyKind::PodcastIndexFeedId,
PropertyValue::Text("not-a-number".into()),
);
write(&sparse_id, PropertyKind::PodcastFeedCoverArtUrl, PropertyValue::Text(String::new()));
@@ -975,6 +991,7 @@ mod tests {
let full = feeds.iter().find(|f| f.document_id == full_id).unwrap();
assert_eq!(full.api_id, "550168");
assert_eq!(full.podcast_index_id, Some(550168));
assert_eq!(full.rss_url.as_deref(), Some("https://feeds.example/jre.xml"));
assert_eq!(full.title, "Joe Rogan");
assert_eq!(full.author, "Joe");
assert_eq!(full.description, "Talk");
@@ -985,6 +1002,7 @@ mod tests {
let sparse = feeds.iter().find(|f| f.document_id == sparse_id).unwrap();
assert_eq!(sparse.api_id, "not-a-number");
assert_eq!(sparse.podcast_index_id, None);
assert_eq!(sparse.rss_url, None);
assert_eq!(sparse.title, "");
assert_eq!(sparse.cover_art_url, None);
assert_eq!(sparse.custom_speed, None);
@@ -999,6 +1017,7 @@ mod tests {
node,
&NewFeed {
api_id: api_id.into(),
rss_url: None,
title: "Show".into(),
description: String::new(),
author: String::new(),
@@ -1018,6 +1037,7 @@ mod tests {
node,
&NewFeed {
api_id: "550168".into(),
rss_url: Some("https://feeds.example/jre.xml".into()),
title: "Joe Rogan".into(),
description: "Talk".into(),
// Empty author and cover art must leave no property row, so
@@ -1034,6 +1054,7 @@ mod tests {
let feed = &feeds[0];
assert_eq!(feed.document_id, id);
assert_eq!(feed.podcast_index_id, Some(550168));
assert_eq!(feed.rss_url.as_deref(), Some("https://feeds.example/jre.xml"));
assert_eq!(feed.title, "Joe Rogan");
assert_eq!(feed.description, "Talk");
assert_eq!(feed.author, "");
+1
View File
@@ -332,6 +332,7 @@ mod tests {
test_node(),
&NewFeed {
api_id: "1".to_string(),
rss_url: None,
title: "A Feed".to_string(),
description: String::new(),
author: String::new(),
+6
View File
@@ -185,6 +185,11 @@ pub enum PropertyKind {
NoteTags,
// PodcastFeed
/// The feed's id in the Podcast Index directory, as text — what episodes
/// are fetched by, and how a search result is matched to a subscription.
PodcastIndexFeedId,
/// The publisher's own address for the feed, as the directory reported it
/// at subscribe time.
PodcastFeedRssUrl,
PodcastFeedDescription,
PodcastFeedAuthor,
@@ -411,6 +416,7 @@ impl PropertyKind {
PropertyKind::OrderTotal => MergeStrategy::LastWriteWins,
PropertyKind::HumanCircles => MergeStrategy::SetUnion,
PropertyKind::NoteTags => MergeStrategy::SetUnion,
PropertyKind::PodcastIndexFeedId => MergeStrategy::LastWriteWins,
PropertyKind::PodcastFeedRssUrl => MergeStrategy::LastWriteWins,
PropertyKind::PodcastFeedDescription => MergeStrategy::LastWriteWins,
PropertyKind::PodcastFeedAuthor => MergeStrategy::LastWriteWins,
+3
View File
@@ -56,6 +56,7 @@ impl PodcastFfi {
.map(|feed| PodcastItem {
id: feed.document_id,
podcast_api_id: feed.api_id,
rss_url: feed.rss_url,
title: feed.title,
description: feed.description,
author: feed.author,
@@ -392,10 +393,12 @@ impl PodcastFfi {
author: String,
cover_art_uri: Option<String>,
last_updated: String,
rss_url: Option<String>,
) -> Result<DocumentID, SyncError> {
let origin_node = self.core.local_node_pubkey_required()?;
let feed = podcast::NewFeed {
api_id: id,
rss_url,
title,
description,
author,
+3 -1
View File
@@ -301,8 +301,10 @@ pub struct FilteredDocumentRow {
pub struct PodcastItem {
/// Document UUID.
pub id: DocumentID,
/// External podcast-index API ID (stored as `PodcastFeedRssUrl`).
/// External podcast-index API ID (stored as `PodcastIndexFeedId`).
pub podcast_api_id: String,
/// The feed's RSS URL, if it was known at subscribe time.
pub rss_url: Option<String>,
pub title: String,
pub description: String,
pub author: String,
+1
View File
@@ -2834,6 +2834,7 @@ mod tests {
"podcast_feed_description",
"podcast_feed_last_fetched_at",
"podcast_feed_rss_url",
"podcast_index_feed_id",
"service_id",
"source_url",
"title",