-
Notifications
You must be signed in to change notification settings - Fork 5
/
doc.go
60 lines (54 loc) · 1.98 KB
/
doc.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
Package podcasts implements a podcast generator.
// initialize the podcast
p := &podcasts.Podcast{
Title: "My podcast",
Description: "This is my very simple podcast.",
Language: "EN",
Link: "http://www.example-podcast.com/my-podcast",
Copyright: "2015 My podcast copyright",
}
// add first podcast item
p.AddItem(&podcasts.Item{
Title: "Episode 1",
GUID: "http://www.example-podcast.com/my-podcast/1/episode-one",
PubDate: podcasts.NewPubDate(time.Now()),
Duration: podcasts.NewDuration(time.Second * 320),
Enclosure: &podcasts.Enclosure{
URL: "http://www.example-podcast.com/my-podcast/1/episode.mp3",
Length: "12312",
Type: "MP3",
},
})
// add second podcast item
p.AddItem(&podcasts.Item{
Title: "Episode 2",
GUID: "http://www.example-podcast.com/my-podcast/2/episode-two",
PubDate: podcasts.NewPubDate(time.Now()),
Duration: podcasts.NewDuration(time.Second * 210),
Enclosure: &podcasts.Enclosure{
URL: "http://www.example-podcast.com/my-podcast/2/episode.mp3",
Length: "46732",
Type: "MP3",
},
})
// get podcast feed, you can pass options to customize it
feed, err := p.Feed(
podcasts.Author("Author Name"),
podcasts.Block,
podcasts.Explicit,
podcasts.Complete,
podcasts.NewFeedURL("http://www.example-podcast.com/new-feed-url"),
podcasts.Subtitle("This is my very simple podcast subtitle."),
podcasts.Summary("This is my very simple podcast summary."),
podcasts.Owner("Podcast Owner", "owner@example-podcast.com"),
podcasts.Image("http://www.example-podcast.com/my-podcast.jpg"),
)
// handle error
if err != nil {
log.Fatal(err)
}
// finally write the xml to any io.Writer
feed.Write(os.Stdout)
*/
package podcasts