diff --git a/Sources/SyndiKit/Formats/Media/PodcastEpisode.swift b/Sources/SyndiKit/Formats/Media/PodcastEpisode.swift index 941f500..97bca65 100644 --- a/Sources/SyndiKit/Formats/Media/PodcastEpisode.swift +++ b/Sources/SyndiKit/Formats/Media/PodcastEpisode.swift @@ -9,6 +9,7 @@ public protocol PodcastEpisode { var duration: TimeInterval? { get } var image: iTunesImage? { get } var enclosure: Enclosure { get } + var people: [PodcastPerson] { get } } struct PodcastEpisodeProperties: PodcastEpisode { @@ -21,6 +22,7 @@ struct PodcastEpisodeProperties: PodcastEpisode { public let duration: TimeInterval? public let image: iTunesImage? public let enclosure: Enclosure + public let people: [PodcastPerson] init?(rssItem: RSSItem) { guard let enclosure = rssItem.enclosure else { @@ -35,5 +37,6 @@ struct PodcastEpisodeProperties: PodcastEpisode { duration = rssItem.itunesDuration?.value image = rssItem.itunesImage self.enclosure = enclosure + people = rssItem.podcastPerson ?? [] } } diff --git a/Tests/SyndiKitTests/RSSCodedTests.swift b/Tests/SyndiKitTests/RSSCodedTests.swift index 5958a92..b3fb02c 100644 --- a/Tests/SyndiKitTests/RSSCodedTests.swift +++ b/Tests/SyndiKitTests/RSSCodedTests.swift @@ -242,7 +242,28 @@ public final class SyndiKitTests: XCTestCase { XCTAssertNotNil(episode.summary) } - func testEpisodePodcastPerson() { + func testEpisodesWithNoPersons() { + guard let feed = try? Content.xmlFeeds["empowerapps-show-cdata_summary"]?.get() else { + XCTFail("Missing Podcast \(name)") + return + } + + guard let rss = feed as? RSSFeed else { + XCTFail("Wrong Type \(name)") + return + } + + let itemTitle = "My Taylor Deep Dish Swift Heroes World Tour" + + guard let item = rss.channel.items.first(where: { $0.title == itemTitle } ) else { + XCTFail("Expected to find episode of title: \(itemTitle)") + return + } + + XCTAssertNil(item.podcastPerson) + } + + func testEpisodesWithHostAndGuestPersons() { guard let feed = try? Content.xmlFeeds["empowerapps-show-cdata_summary"]?.get() else { XCTFail("Missing Podcast \(name)") return