Skip to content

Commit

Permalink
add <podcast:publisher>
Browse files Browse the repository at this point in the history
  • Loading branch information
joksas committed May 15, 2024
1 parent 2e20766 commit 5bd2a02
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions namespace_podcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ var (
PodcastMediumAudioBook PodcastMedium = "audiobook"
PodcastMediumNewsletter PodcastMedium = "newsletter"
PodcastMediumBlog PodcastMedium = "blog"

PodcastMediumPublisher PodcastMedium = "publisher"

PodcastMediumPodcastList PodcastMedium = "podcastL"
PodcastMediumMusicList PodcastMedium = "musicL"
PodcastMediumVideoList PodcastMedium = "videoL"
PodcastMediumFilmList PodcastMedium = "filmL"
PodcastMediumAudioBookList PodcastMedium = "audiobookL"
PodcastMediumNewsletterList PodcastMedium = "newsletterL"
PodcastMediumBlogList PodcastMedium = "blogL"
PodcastMediumPublisherList PodcastMedium = "publisherL"
PodcastMediumMixedList PodcastMedium = "mixed"
)

// PodcastTXT is intended for free-form text and is modeled after the DNS "TXT"
Expand All @@ -291,6 +303,14 @@ type PodcastPodping struct {
UsesPodping *bool `xml:"usesPodping,attr"`
}

// PodcastPublisher allows a podcast feed to link to it's "publisher feed" parent.
// Read more at
// https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#publisher
type PodcastPublisher struct {
XMLName xml.Name `xml:"podcast:publisher"`
RemoteItems []PodcastRemoteItem
}

// PodcastAlternateEnclosure provides different versions of, or companion media to the main `<enclosure>` file.
// Read more at
// https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#alternate-enclosure
Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type Channel struct {
PodcastMedium *PodcastMedium `xml:"podcast:medium"`
PodcastPersons []PodcastPerson
PodcastPodping *PodcastPodping
PodcastPublisher *PodcastPublisher
PodcastRemoteItems []PodcastRemoteItem
PodcastSingleItem *PodcastSingleItem
PodcastTXTs []PodcastTXT
Expand Down
12 changes: 12 additions & 0 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ func TestMarshal(t *testing.T) {
Caption: "Support “Bookworm Podcast”",
},
},
PodcastPublisher: &types.PodcastPublisher{
RemoteItems: []types.PodcastRemoteItem{
{
FeedGUID: uuid.MustParse("003af0a0-6a45-55cf-b765-68e3d349551a"),
FeedURL: pointer("https://agilesetmedia.com/assets/static/feeds/publisher.xml"),
Medium: pointer(types.PodcastMediumPublisher),
},
},
},
PodcastSingleItem: &types.PodcastSingleItem{
Value: false,
},
Expand Down Expand Up @@ -436,6 +445,9 @@ func TestMarshal(t *testing.T) {
<podcast:medium>podcast</podcast:medium>
<podcast:person href="https://example.com/johnsmith/blog" img="http://example.com/images/johnsmith.jpg">John Smith</podcast:person>
<podcast:podping usesPodping="true"></podcast:podping>
<podcast:publisher>
<podcast:remoteItem feedGuid="003af0a0-6a45-55cf-b765-68e3d349551a" feedUrl="https://agilesetmedia.com/assets/static/feeds/publisher.xml" medium="publisher"></podcast:remoteItem>
</podcast:publisher>
<podcast:singleItem>false</podcast:singleItem>
<podcast:txt>naj3eEZaWVVY9a38uhX8FekACyhtqP4JN</podcast:txt>
<podcast:txt purpose="verify">S6lpp-7ZCn8-dZfGc-OoyaG</podcast:txt>
Expand Down

0 comments on commit 5bd2a02

Please sign in to comment.