-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgopodcast_xml_fix.go
274 lines (247 loc) · 7.91 KB
/
gopodcast_xml_fix.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
// Code generated by gopodcast generator. DO NOT EDIT.
// This file contains copies of structs to fix an issue with namespace prefix support in go `encoding/xml` package
package gopodcast
import "encoding/xml"
type xmlFixfeed struct {
XMLName xml.Name `xml:"rss"`
Version string `xml:"version,attr"`
XMLNSContent string `xml:"xmlns content,attr"`
XMLNSPodcast string `xml:"xmlns podcast,attr"`
XMLNSAtom string `xml:"xmlns atom,attr"`
XMLNSITunes string `xml:"xmlns itunes,attr"`
Channel *xmlFixPodcast `xml:"channel"`
}
func (s *xmlFixfeed) Translate() *feed {
if s == nil {
return nil
}
var r feed
r.XMLName = s.XMLName
r.Version = s.Version
r.XMLNSContent = s.XMLNSContent
r.XMLNSPodcast = s.XMLNSPodcast
r.XMLNSAtom = s.XMLNSAtom
r.XMLNSITunes = s.XMLNSITunes
r.Channel = s.Channel.Translate()
return &r
}
type xmlFixPodcast struct {
AtomLink xmlFixAtomLink `xml:"http://www.w3.org/2005/Atom link"`
Title string `xml:"title"`
Description xmlFixDescription `xml:"description"`
Link string `xml:"link"`
Language string `xml:"language"`
ITunesCategory []xmlFixITunesCategory `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd category"`
ITunesExplicit Bool `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd explicit"`
ITunesImage xmlFixITunesImage `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd image"`
PodcastLocked *YesNo `xml:"https://podcastindex.org/namespace/1.0 locked,omitempty"`
PodcastGUID string `xml:"https://podcastindex.org/namespace/1.0 guid,omitempty"`
ITunesAuthor string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd author,omitempty"`
Copyright string `xml:"copyright,omitempty"`
PodcastText *xmlFixPodcastText `xml:"https://podcastindex.org/namespace/1.0 txt,omitempty"`
PodcastFunding *xmlFixPodcastFunding `xml:"https://podcastindex.org/namespace/1.0 funding,omitempty"`
ITunesType string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd type,omitempty"`
ITunesComplete *YesNo `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd complete,omitempty"`
Items []*xmlFixItem `xml:"item"`
}
func (s *xmlFixPodcast) Translate() *Podcast {
if s == nil {
return nil
}
var r Podcast
vAtomLink := s.AtomLink.Translate()
r.AtomLink = *vAtomLink
r.Title = s.Title
vDescription := s.Description.Translate()
r.Description = *vDescription
r.Link = s.Link
r.Language = s.Language
vITunesCategory := make([]ITunesCategory, 0)
for _, v := range s.ITunesCategory {
x := v.Translate()
vITunesCategory = append(vITunesCategory, *x)
}
r.ITunesCategory = vITunesCategory
r.ITunesExplicit = s.ITunesExplicit
vITunesImage := s.ITunesImage.Translate()
r.ITunesImage = *vITunesImage
r.PodcastLocked = s.PodcastLocked
r.PodcastGUID = s.PodcastGUID
r.ITunesAuthor = s.ITunesAuthor
r.Copyright = s.Copyright
r.PodcastText = s.PodcastText.Translate()
r.PodcastFunding = s.PodcastFunding.Translate()
r.ITunesType = s.ITunesType
r.ITunesComplete = s.ITunesComplete
vItems := make([]*Item, 0)
for _, v := range s.Items {
vItems = append(vItems, v.Translate())
}
r.Items = vItems
return &r
}
type xmlFixAtomLink struct {
Href string `xml:"href,attr"`
Rel string `xml:"rel,attr"`
Type string `xml:"type,attr"`
}
func (s *xmlFixAtomLink) Translate() *AtomLink {
if s == nil {
return nil
}
var r AtomLink
r.Href = s.Href
r.Rel = s.Rel
r.Type = s.Type
return &r
}
type xmlFixDescription struct {
Text string `xml:",cdata"`
}
func (s *xmlFixDescription) Translate() *Description {
if s == nil {
return nil
}
var r Description
r.Text = s.Text
return &r
}
type xmlFixITunesCategory struct {
Text string `xml:"text,attr"`
SubCategory *xmlFixITunesCategory `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd category,omitempty"`
}
func (s *xmlFixITunesCategory) Translate() *ITunesCategory {
if s == nil {
return nil
}
var r ITunesCategory
r.Text = s.Text
r.SubCategory = s.SubCategory.Translate()
return &r
}
type xmlFixITunesImage struct {
Href string `xml:"href,attr"`
}
func (s *xmlFixITunesImage) Translate() *ITunesImage {
if s == nil {
return nil
}
var r ITunesImage
r.Href = s.Href
return &r
}
type xmlFixPodcastText struct {
Purpose string `xml:"purpose,attr,omitempty"`
Text string `xml:",chardata"`
}
func (s *xmlFixPodcastText) Translate() *PodcastText {
if s == nil {
return nil
}
var r PodcastText
r.Purpose = s.Purpose
r.Text = s.Text
return &r
}
type xmlFixPodcastFunding struct {
URL string `xml:"url,attr"`
Text string `xml:",chardata"`
}
func (s *xmlFixPodcastFunding) Translate() *PodcastFunding {
if s == nil {
return nil
}
var r PodcastFunding
r.URL = s.URL
r.Text = s.Text
return &r
}
type xmlFixItem struct {
Title string `xml:"title"`
Enclosure xmlFixEnclosure `xml:"enclosure"`
GUID xmlFixItemGUID `xml:"guid"`
Link string `xml:"link,omitempty"`
PubDate *Time `xml:"pubDate,omitempty"`
Description *xmlFixDescription `xml:"description,omitempty"`
ITunesDuration string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd duration,omitempty"`
ITunesImage *xmlFixITunesImage `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd image,omitempty"`
ITunesExplicit *Bool `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd explicit,omitempty"`
PodcastTranscript []xmlFixPodcastTranscript `xml:"https://podcastindex.org/namespace/1.0 transcript,omitempty"`
ITunesEpisode string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd episode,omitempty"`
ITunesSeason string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd season,omitempty"`
ITunesEpisodeType string `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd episodeType,omitempty"`
ITunesBlock *YesNo `xml:"http://www.itunes.com/dtds/podcast-1.0.dtd block,omitempty"`
}
func (s *xmlFixItem) Translate() *Item {
if s == nil {
return nil
}
var r Item
r.Title = s.Title
vEnclosure := s.Enclosure.Translate()
r.Enclosure = *vEnclosure
vGUID := s.GUID.Translate()
r.GUID = *vGUID
r.Link = s.Link
r.PubDate = s.PubDate
r.Description = s.Description.Translate()
r.ITunesDuration = s.ITunesDuration
r.ITunesImage = s.ITunesImage.Translate()
r.ITunesExplicit = s.ITunesExplicit
vPodcastTranscript := make([]PodcastTranscript, 0)
for _, v := range s.PodcastTranscript {
x := v.Translate()
vPodcastTranscript = append(vPodcastTranscript, *x)
}
r.PodcastTranscript = vPodcastTranscript
r.ITunesEpisode = s.ITunesEpisode
r.ITunesSeason = s.ITunesSeason
r.ITunesEpisodeType = s.ITunesEpisodeType
r.ITunesBlock = s.ITunesBlock
return &r
}
type xmlFixEnclosure struct {
Length int64 `xml:"length,attr"`
Type string `xml:"type,attr"`
URL string `xml:"url,attr"`
}
func (s *xmlFixEnclosure) Translate() *Enclosure {
if s == nil {
return nil
}
var r Enclosure
r.Length = s.Length
r.Type = s.Type
r.URL = s.URL
return &r
}
type xmlFixItemGUID struct {
IsPermaLink *Bool `xml:"isPermaLink,attr,omitempty"`
Text string `xml:",chardata"`
}
func (s *xmlFixItemGUID) Translate() *ItemGUID {
if s == nil {
return nil
}
var r ItemGUID
r.IsPermaLink = s.IsPermaLink
r.Text = s.Text
return &r
}
type xmlFixPodcastTranscript struct {
URL string `xml:"url,attr"`
Type string `xml:"type,attr"`
Rel string `xml:"rel,attr,omitempty"`
Language string `xml:"language,attr,omitempty"`
}
func (s *xmlFixPodcastTranscript) Translate() *PodcastTranscript {
if s == nil {
return nil
}
var r PodcastTranscript
r.URL = s.URL
r.Type = s.Type
r.Rel = s.Rel
r.Language = s.Language
return &r
}