@@ -17,8 +17,10 @@ import (
17
17
"gopkg.in/yaml.v2"
18
18
)
19
19
20
+ // GetPubDate returns the `time.Time` value for current publication.
20
21
var GetPubDate = time .Now
21
22
23
+ // GetFeed returns the content of the XML feed defined in `URL`, or an error.
22
24
var GetFeed = func (URL string ) (string , error ) {
23
25
resp , err := http .Get (URL )
24
26
if err != nil {
@@ -34,6 +36,7 @@ var GetFeed = func(URL string) (string, error) {
34
36
return string (bodyBytes ), nil
35
37
}
36
38
39
+ // GetScript returns the content of the script which name matches the `episodeTag` in HTML, or an error.
37
40
var GetScript = func (episodeTag string ) (string , error ) {
38
41
q := fmt .Sprintf ("name contains '%v'" , episodeTag )
39
42
@@ -63,6 +66,7 @@ var GetScript = func(episodeTag string) (string, error) {
63
66
return content , nil
64
67
}
65
68
69
+ // Podcast contains all the parameters to get the episode details for a podcast.
66
70
type Podcast struct {
67
71
FeedURL string `yaml:"feedURL"`
68
72
MasterURLPattern string `yaml:"masterURLPattern"`
@@ -85,6 +89,7 @@ type Podcast struct {
85
89
details map [string ]interface {}
86
90
}
87
91
92
+ // NewPodcast constructs the `Podcast` object for a `trackName` according with the properties defined in the `YAMLFile`, or an error.
88
93
func NewPodcast (trackName , YAMLFile string ) (* Podcast , error ) {
89
94
f , err := ioutil .ReadFile (YAMLFile )
90
95
if err != nil {
0 commit comments