From 6196d58a8d6d432d799736fc9cf6740229f021c3 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Fri, 25 Nov 2022 20:53:54 -0500 Subject: schema: add `PodcastFeed` --- schema/schema.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'schema/schema.go') diff --git a/schema/schema.go b/schema/schema.go index c114fb1..e0712a3 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -61,6 +61,28 @@ type YouTubeFeed struct { Entries []YouTubeEntry `xml:"entry"` } +// Represents a direct link to a Podcast. +type PodcastLink struct { + XMLName xml.Name `xml:"enclosure"` + Url string `xml:"url,attr"` +} + +// Represents an entry in the Podcast feed. +type PodcastEntry struct { + XMLName xml.Name `xml:"item"` + Id string `xml:"guid"` + Title string `xml:"title"` + Pub string `xml:"pubDate"` + PubTime time.Time + Link PodcastLink `xml:"enclosure"` +} + +// Represents a iTunes Podcast feed. +type PodcastFeed struct { + XMLName xml.Name `xml:"rss"` + Entries []PodcastEntry `xml:"channel>item"` +} + func (e Entry) TitleContains(contains string) bool { return strings.Contains(strings.ToLower(e.Title), strings.ToLower(contains)) } -- cgit v1.2.3