1
0

We are closer for working IcecastLastPlayedSongs().

This commit is contained in:
Alexander Andreev 2022-03-10 00:10:00 +04:00
parent c4ea8aef8c
commit 6a61c56891
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -3,7 +3,6 @@ package radio
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"net/http" "net/http"
"os/exec" "os/exec"
"strings" "strings"
@ -79,9 +78,11 @@ func IcecastLastPlayedSongs(lastNSongs int, playlistPath string) []Song {
for _, song := range songs_ { for _, song := range songs_ {
ts := strings.Split(song, "|") 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]) 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{ songs = append(songs, Song{
Time: tim.UTC().Format("15:04"), Time: tim.UTC().Format("15:04"),
Artist: at[0], Artist: at[0],