From 4c7e7f29709207138fbb5126d484fd52319f5719 Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Mon, 31 Aug 2020 15:34:52 -0500 Subject: [PATCH] added total tracks and last updated date --- convert.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/convert.go b/convert.go index 68c3a64..168b5a6 100644 --- a/convert.go +++ b/convert.go @@ -6,6 +6,7 @@ import ( "strconv" "os" "bufio" + "time" "github.com/beevik/etree" ) @@ -154,6 +155,9 @@ func main() { // at this point, our playlist should be sorted + // get date + currentTime := time.Now() + // create the xml file file, err := os.OpenFile("main_parsed.xml", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { @@ -166,6 +170,13 @@ func main() { fmt.Fprintln(w, ``) fmt.Fprintln(w, "") + // print out information at the header + fmt.Fprintln(w, "") + fmt.Fprintln(w, "dtam playlist") + fmt.Fprintln(w, "" + strconv.Itoa(len(playlist_tracks)) + " tracks (Last updated: " + currentTime.Format("Jan 02, 2006") + ")") + fmt.Fprintln(w, "https://dtam.pw/music/empty.m4a") + fmt.Fprintln(w, "") + // cycle through our ordered playlist and write it to the file for _, e := range playlist { fmt.Fprintln(w, "")