diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c84ade..ac04f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ The long form, with what was wrong before and how it was found, is in ### Added - Directory has a row of chips above it: Podcasts, Blogs, and once Podcasts is picked, each - podcast's own iTunes category. Picking one filters the Directory in place. + podcast's own iTunes category, the narrower one where a show gives two (Games, not Leisure). + Picking one filters the Directory in place. ### Changed diff --git a/src/feed.rs b/src/feed.rs index c5f7ab6..9ac5fde 100644 --- a/src/feed.rs +++ b/src/feed.rs @@ -538,10 +538,12 @@ fn from_rss(ch: rss::Channel, bytes: &[u8]) -> ParsedFeed { .map(str::to_owned) .or_else(|| ch.image().map(|i| i.url().to_owned())), // Only the iTunes one: Apple's list is fixed, while a plain is freeform and - // would fill the Directory with one-off tags. The top level only, for the same reason. + // would fill the Directory with one-off tags. The subcategory where there is one: Apple + // files every tabletop and gaming show under Leisure, which says little; Games says it. category: ch .itunes_ext() .and_then(|i| i.categories().first()) + .map(|c| c.subcategory().filter(|s| !s.text().trim().is_empty()).unwrap_or(c)) .and_then(|c| non_empty(Some(c.text().trim()))), entries, } @@ -717,7 +719,7 @@ mod tests { assert_eq!(feed.title.as_deref(), Some("Test Cast")); assert_eq!(feed.ttl_mins, Some(45)); - assert_eq!(feed.category.as_deref(), Some("Technology"), "the first, top level only"); + assert_eq!(feed.category.as_deref(), Some("Podcasting"), "the first, by its subcategory"); assert_eq!(feed.entries.len(), 3); let ep = &feed.entries[0];