diff --git a/feed.go b/feed.go index 1511d71..29d3c74 100644 --- a/feed.go +++ b/feed.go @@ -68,17 +68,21 @@ type Item struct { XMLName xml.Name `xml:"item"` Title string `xml:"title"` GUID string `xml:"guid"` + Link string `xml:"link"` PubDate *PubDate `xml:"pubDate"` Author string `xml:"itunes:author,omitempty"` Block string `xml:"itunes:block,omitempty"` - Duration time.Duration `xml:"itunes:duration,omitempty"` + Duration string `xml:"itunes:duration,omitempty"` Explicit string `xml:"itunes:explicit,omitempty"` ClosedCaptioned string `xml:"itunes:isClosedCaptioned,omitempty"` Order int `xml:"itunes:order,omitempty"` + ItunesTitle string `xml:"itunes:title,omitempty"` Subtitle string `xml:"itunes:subtitle,omitempty"` Summary *ItunesSummary `xml:"itunes:summary,omitempty"` Enclosure *Enclosure Image *ItunesImage + Season int `xml:"itunes:season,omitempty"` + Episode int `xml:"itunes:episode,omitempty"` } // Channel represents a RSS channel for given podcast. diff --git a/options.go b/options.go index bd3743b..66de23e 100644 --- a/options.go +++ b/options.go @@ -13,11 +13,13 @@ var ( ErrInvalidImage = errors.New("podcasts: invalid image") ) +// Values represents positive/negative value used in XML feed. const ( - // ValueYes represents positive value used in XML feed. ValueYes = "yes" + ValueNo = "no" ) + // Author sets itunes:author of given feed. func Author(author string) func(f *Feed) error { return func(f *Feed) error { @@ -37,13 +39,17 @@ func Explicit(f *Feed) error { f.Channel.Explicit = ValueYes return nil } +// NotExplicit disables itunes:explicit of given feed. +func NotExplicit(f *Feed) error { + f.Channel.Explicit = ValueNo + return nil +} // Complete enables itunes:complete of given feed. func Complete(f *Feed) error { f.Channel.Complete = ValueYes return nil } - // NewFeedURL sets itunes:new-feed-url of given feed. func NewFeedURL(newURL string) func(f *Feed) error { return func(f *Feed) error { @@ -102,3 +108,24 @@ func Image(href string) func(f *Feed) error { return nil } } + + + +// Category appends itunes:category of given feed. +// Execute multiple times to add new main category and subcategories +func Category(category string, subcategories []string) func(f *Feed) error { + return func(f *Feed) error { + c := &ItunesCategory{ + Text: category, + } + + for _, subcategory := range subcategories { + c.Categories = append(c.Categories, &ItunesCategory{ + Text: subcategory, + }) + } + + f.Channel.Categories = append(f.Channel.Categories, c) + return nil + } +}