aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/main.go b/main.go
index 75750aa..599a02d 100644
--- a/main.go
+++ b/main.go
@@ -69,17 +69,22 @@ func main() {
describeEpisodes(feed)
feed.Created = time.Now()
- outputFile := outputPath + "radiorus-" + programNumber + ".rss"
- writeFeed(feed, outputFile)
+ output := createFeed(feed)
+
+ outputFile := outputPath + "radiorus-" + programNumber + ".rss"
+ writeFile(output, outputFile)
}
-func writeFeed(feed *feeds.Feed, filename string) {
+func createFeed(feed *feeds.Feed) []byte {
rss, err := feed.ToRss()
if err != nil {
log.Fatal(err)
}
- output := []byte(rss)
+ return []byte(rss)
+}
+
+func writeFile(output []byte, filename string) {
if err := ioutil.WriteFile(filename, output, 0644); err != nil {
log.Fatal(err)
}