Skip to content

Commit

Permalink
add live items
Browse files Browse the repository at this point in the history
  • Loading branch information
joksas committed Dec 5, 2023
1 parent b650a07 commit 7b6fc0f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
45 changes: 45 additions & 0 deletions namespace_podcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,48 @@ type PodcastSource struct {
URI string `xml:"uri,attr"`
ContentType *string `xml:"contentType,attr"`
}

type PodcastContentLink struct {
XMLName xml.Name `xml:"podcast:contentLink"`
Href string `xml:"href,attr"`
Text string `xml:",chardata"`
}

type PodcastLiveStatus string

var (
PodcastLiveStatusPending PodcastLiveStatus = "pending"
PodcastLiveStatusLive PodcastLiveStatus = "live"
PodcastLiveStatusEnded PodcastLiveStatus = "ended"
)

type PodcastLiveItem struct {
XMLName xml.Name `xml:"podcast:liveItem"`

Status PodcastLiveStatus `xml:"status,attr"`
StartTime time.Time `xml:"start,attr"`
EndTime *time.Time `xml:"end,attr,omitempty"`

Description *Description `xml:"description"`
Enclosure *Enclosure
GUID *GUID
Link *string `xml:"link"`
Title *string `xml:"title"`
ContentEncoded *ContentEncoded
ITunesEpisodeNumber *int64 `xml:"itunes:episode"`
ITunesEpisodeType *string `xml:"itunes:episodeType"`
ITunesExplicit *bool `xml:"itunes:explicit"`
ITunesImage *ITunesImage
ITunesSeasonNumber *int64 `xml:"itunes:season"`
PodcastAlternateEnclosures []PodcastAlternateEnclosure
PodcastContentLinks []PodcastContentLink
PodcastEpisode *PodcastEpisode
PodcastISRC *PodcastISRC
PodcastLocation *PodcastLocation
PodcastPersons []PodcastPerson
PodcastSeason *PodcastSeason
PodcastSoundbites []PodcastSoundbite
PodcastTXTs []PodcastTXT
PodcastTranscripts []PodcastTranscript
PodcastValue *PodcastValue
}
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type Channel struct {
PodcastTXTs []PodcastTXT
PodcastTrailers []PodcastTrailer
PodcastValue *PodcastValue
PodcastLiveItems []PodcastLiveItem
Items []Item
}

Expand Down
28 changes: 28 additions & 0 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,28 @@ func TestMarshal(t *testing.T) {
PodcastPodping: &types.PodcastPodping{
UsesPodping: pointer(true),
},
PodcastLiveItems: []types.PodcastLiveItem{
{
Status: types.PodcastLiveStatusLive,
StartTime: time.Date(2021, time.September, 9, 26, 7, 30, 0, time.UTC),
EndTime: pointer(time.Date(2021, time.September, 9, 26, 9, 30, 0, time.UTC)),
Title: pointer("Podcasting 2.0 Live Stream"),
GUID: &types.GUID{
GUID: "e32b4890-983b-4ce5-8b46-f2d6bc1d8819",
},
Enclosure: &types.Enclosure{
URL: "https://example.com/pc20/livestream?format=.mp3",
Mimetype: "audio/mpeg",
Length: 312,
},
PodcastContentLinks: []types.PodcastContentLink{
{
Href: "https://example.com/html/livestream",
Text: "Listen Live!",
},
},
},
},
Items: []types.Item{
{
Title: pointer("Simple Episode"),
Expand Down Expand Up @@ -426,6 +448,12 @@ func TestMarshal(t *testing.T) {
<podcast:remoteItem itemGuid="https://podcastindex.org/podcast/4148683#3" feedGuid="a94f5cc9-8c58-55fc-91fe-a324087a655b" medium="music"></podcast:remoteItem>
</podcast:valueTimeSplit>
</podcast:value>
<podcast:liveItem status="live" start="2021-09-10T02:07:30Z" end="2021-09-10T02:09:30Z">
<enclosure url="https://example.com/pc20/livestream?format=.mp3" length="312" type="audio/mpeg"></enclosure>
<guid>e32b4890-983b-4ce5-8b46-f2d6bc1d8819</guid>
<title>Podcasting 2.0 Live Stream</title>
<podcast:contentLink href="https://example.com/html/livestream">Listen Live!</podcast:contentLink>
</podcast:liveItem>
<item>
<description>This is a simple episode &amp; its description.</description>
<enclosure url="https://rssblue.com/@bookworm-podcast/simple-episode/simple-episode.mp3" length="1024" type="audio/mpeg"></enclosure>
Expand Down

0 comments on commit 7b6fc0f

Please sign in to comment.