added total tracks and last updated date
This commit is contained in:
11
convert.go
11
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, `<playlist xmlns="https://xspf.org/ns/0/" version="1">`)
|
||||
fmt.Fprintln(w, "<tracklist>")
|
||||
|
||||
// print out information at the header
|
||||
fmt.Fprintln(w, "<track>")
|
||||
fmt.Fprintln(w, "<title>dtam playlist</title>")
|
||||
fmt.Fprintln(w, "<creator>" + strconv.Itoa(len(playlist_tracks)) + " tracks (Last updated: " + currentTime.Format("Jan 02, 2006") + ")</creator>")
|
||||
fmt.Fprintln(w, "<location>https://dtam.pw/music/empty.m4a</location>")
|
||||
fmt.Fprintln(w, "</track>")
|
||||
|
||||
// cycle through our ordered playlist and write it to the file
|
||||
for _, e := range playlist {
|
||||
fmt.Fprintln(w, "<track>")
|
||||
|
Reference in New Issue
Block a user