-
Notifications
You must be signed in to change notification settings - Fork 5
/
podcast.go
33 lines (30 loc) · 723 Bytes
/
podcast.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package podcasts
// Podcast represents a web podcast.
type Podcast struct {
Title string
Description string
Link string
Language string
Copyright string
items []*Item
}
// AddItem adds an item to the podcast.
func (p *Podcast) AddItem(item *Item) {
p.items = append(p.items, item)
}
// Feed creates a new feed for current podcast.
func (p *Podcast) Feed(options ...func(f *Feed) error) (*Feed, error) {
f := &Feed{
Xmlns: rssXmlns,
Version: rssVersion,
Channel: &Channel{
Title: p.Title,
Description: p.Description,
Link: p.Link,
Copyright: p.Copyright,
Language: p.Language,
Items: p.items,
},
}
return f, f.SetOptions(options...)
}