diff --git a/internal/http/handlers.go b/internal/http/handlers.go index 4f8768d..22c7b92 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -32,14 +32,6 @@ func (h *Handlers) Index(w http.ResponseWriter, r *http.Request) { status, err := radio.IcecastGetStatus(h.icecastUrl) if err != nil { log.Println("failed to get Icecast status:", err) - } else { - if tim, err := time.Parse(time.RFC1123Z, status.ServerStartDate); err == nil { - status.ServerStartDate = utils.ToClientTimezone(tim, r).Format(time.RFC1123) - } - - if tim, err := time.Parse(FormatISO8601, status.ServerStartISO8601); err == nil { - status.ServerStartISO8601 = utils.ToClientTimezone(tim, r).Format(FormatISO8601) - } } songs, err := radio.IcecastLastSongs(h.icecastPlaylistPath) @@ -64,14 +56,6 @@ func (h *Handlers) Status(w http.ResponseWriter, r *http.Request) { return } - if tim, err := time.Parse(time.RFC1123Z, status.ServerStartDate); err == nil { - status.ServerStartDate = utils.ToClientTimezone(tim, r).Format(time.RFC1123) - } - - if tim, err := time.Parse(FormatISO8601, status.ServerStartISO8601); err == nil { - status.ServerStartISO8601 = utils.ToClientTimezone(tim, r).Format(FormatISO8601) - } - w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(status) } diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index 135abff..e364c5e 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -46,11 +46,9 @@ func (is *IcecastStatusDTO) SongName() string { } type IcecastStatus struct { - ServerStartISO8601 string `json:"server_start_iso8601"` - ServerStartDate string `json:"server_start_date"` - SongName string `json:"song"` - ListenerPeak int `json:"listener_peak"` - Listeners int `json:"listeners"` + SongName string `json:"song"` + ListenerPeak int `json:"listener_peak"` + Listeners int `json:"listeners"` } type Song struct { @@ -72,11 +70,9 @@ func IcecastGetStatus(icecastURL string) (*IcecastStatus, error) { } return &IcecastStatus{ - ServerStartISO8601: iceStatDTO.Icestats.ServerStartISO8601, - ServerStartDate: iceStatDTO.Icestats.ServerStartDate, - SongName: iceStatDTO.SongName(), - ListenerPeak: iceStatDTO.Icestats.Source.ListenerPeak, - Listeners: iceStatDTO.Icestats.Source.Listeners, + SongName: iceStatDTO.SongName(), + ListenerPeak: iceStatDTO.Icestats.Source.ListenerPeak, + Listeners: iceStatDTO.Icestats.Source.Listeners, }, nil } diff --git a/web/templates/index.pug b/web/templates/index.pug index 7108886..ab94235 100644 --- a/web/templates/index.pug +++ b/web/templates/index.pug @@ -45,11 +45,6 @@ html(lang='en') source(src='/live/stream.ogg' type='audio/ogg') | Your browser doesn't support an audio element, it's sad... But you always can take the #[a(href='/playlist') playlist]! div - if status.ServerStartDate != "" - p#radio-status On-air since - time(datetime=status.ServerStartISO8601)= status.ServerStartDate - else - p#radio-status Radio is offline. p Now playing: #[span#radio-song #{status.SongName}] p Current/peak listeners: #[span#radio-listeners #{status.Listeners}] / #[span#radio-listener-peak #{status.ListenerPeak}] p