From 6a61c56891f931c3606ff9deb9694e39a2e68673 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 10 Mar 2022 00:10:00 +0400 Subject: [PATCH] We are closer for working IcecastLastPlayedSongs(). --- internal/radio/icecast.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index 8a10b3d..d46c85f 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -3,7 +3,6 @@ package radio import ( "encoding/json" "fmt" - "log" "net/http" "os/exec" "strings" @@ -79,9 +78,11 @@ func IcecastLastPlayedSongs(lastNSongs int, playlistPath string) []Song { for _, song := range songs_ { ts := strings.Split(song, "|") - log.Println(len(ts), ts) + if len(ts) <= 1 { + continue + } tim, _ := time.Parse("02/01/2006:15:04:05 -0700", ts[0]) - at := strings.Split(ts[1], "-") + at := strings.Split(ts[1], " - ") songs = append(songs, Song{ Time: tim.UTC().Format("15:04"), Artist: at[0],