|
|
|
@ -52,7 +52,7 @@ type Podcast struct {
|
|
|
|
|
INewFeedURL string `xml:"itunes:new-feed-url,omitempty"`
|
|
|
|
|
IOwner *Author // Author is formatted for itunes as-is
|
|
|
|
|
ICategories []*ICategory
|
|
|
|
|
|
|
|
|
|
IType string `xml:"itunes:type,omitempty"`
|
|
|
|
|
Items []*Item
|
|
|
|
|
|
|
|
|
|
encode func(w io.Writer, o interface{}) error
|
|
|
|
@ -72,7 +72,7 @@ func New(title, link, description string,
|
|
|
|
|
PubDate: parseDateRFC1123Z(pubDate),
|
|
|
|
|
LastBuildDate: parseDateRFC1123Z(lastBuildDate),
|
|
|
|
|
Language: "en-us",
|
|
|
|
|
|
|
|
|
|
IType: "episodic",
|
|
|
|
|
// setup dependency (could inject later)
|
|
|
|
|
encode: encoder,
|
|
|
|
|
}
|
|
|
|
@ -328,6 +328,12 @@ func (p *Podcast) AddItem(i Item) (int, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p.Items = append(p.Items, &i)
|
|
|
|
|
|
|
|
|
|
//if episode number is not passed; we will just increase the items by one
|
|
|
|
|
if i.IEpisode == 0 && p.IType == "episodic" {
|
|
|
|
|
i.IEpisode = len(p.Items) + 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return len(p.Items), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -382,6 +388,21 @@ func (p *Podcast) AddSummary(summary string) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AddIType adds the specified type to the podcast to the podcast.
|
|
|
|
|
func (p *Podcast) AddIType(iType string) {
|
|
|
|
|
if len(iType) == 0 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if iType == "serial" {
|
|
|
|
|
p.IType = "serial"
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p.IType = "episodic"
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bytes returns an encoded []byte slice.
|
|
|
|
|
func (p *Podcast) Bytes() []byte {
|
|
|
|
|
return []byte(p.String())
|
|
|
|
|