@@ -3,9 +3,12 @@ package types
33import (
44 "encoding/xml"
55 "fmt"
6+ "math"
67 "strconv"
78 "strings"
89 "time"
10+
11+ "github.com/google/uuid"
912)
1013
1114// NamespacePodcast is the Podcasting 2.0 namespace.
@@ -36,11 +39,12 @@ type PodcastChapters struct {
3639// PodcastValue enables to describe Value 4 Value payments. Read more at
3740// https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#value
3841type PodcastValue struct {
39- XMLName xml.Name `xml:"podcast:value"`
40- Type string `xml:"type,attr"`
41- Method string `xml:"method,attr"`
42- Suggested * float64 `xml:"suggested,attr,omitempty"`
43- Recipients []PodcastValueRecipient
42+ XMLName xml.Name `xml:"podcast:value"`
43+ Type string `xml:"type,attr"`
44+ Method string `xml:"method,attr"`
45+ Suggested * float64 `xml:"suggested,attr,omitempty"`
46+ Recipients []PodcastValueRecipient
47+ ValueTimeSplits []PodcastValueTimeSplit
4448}
4549
4650// PodcastValueRecipient describes the recipient of Value 4 Value payments.
@@ -57,6 +61,29 @@ type PodcastValueRecipient struct {
5761 Fee * bool `xml:"bool,attr"`
5862}
5963
64+ // PodcastValueTimeSplit describes value splits that are valid for a certain period of time
65+ // Read more at
66+ // https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#value-time-split
67+ type PodcastValueTimeSplit struct {
68+ XMLName xml.Name `xml:"podcast:valueTimeSplit"`
69+ StartTime DurationInteger `xml:"startTime,attr"`
70+ Duration DurationInteger `xml:"duration,attr"`
71+ RemoteStartTime * DurationInteger `xml:"remoteStartTime,attr,omitempty"`
72+ RemotePercentage * uint `xml:"remotePercentage,attr,omitempty"`
73+ Recipients []PodcastValueRecipient
74+ RemoteItem PodcastRemoteItem
75+ }
76+
77+ // PodcastRemoteItem provides a way to "point" to another feed or item in it.
78+ // Read more at
79+ // https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#remote-item
80+ type PodcastRemoteItem struct {
81+ XMLName xml.Name `xml:"podcast:remoteItem"`
82+ ItemGUID * string `xml:"itemGuid,attr"`
83+ FeedGUID uuid.UUID `xml:"feedGuid,attr"`
84+ Medium * PodcastMedium `xml:"medium,attr"`
85+ }
86+
6087// PodcastLocked tells podcast hosting platforms whether they are allowed to import
6188// the feed. Read more at
6289// https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#locked
@@ -170,6 +197,17 @@ func (duration Duration) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
170197 return xml.Attr {Name : xml.Name {Local : name .Local }, Value : s }, nil
171198}
172199
200+ // DurationInteger denotes timestamps and durations during a podcast episode, but which are converted to integer seconds.
201+ type DurationInteger time.Duration
202+
203+ func (duration DurationInteger ) MarshalXMLAttr (name xml.Name ) (xml.Attr , error ) {
204+ seconds := time .Duration (duration ).Seconds ()
205+ seconds = math .Round (seconds )
206+ s := strconv .Itoa (int (seconds ))
207+
208+ return xml.Attr {Name : xml.Name {Local : name .Local }, Value : s }, nil
209+ }
210+
173211// PodcastPerson specifies a person of interest to the podcast. Read more at
174212// https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#person
175213type PodcastPerson struct {
0 commit comments