Don't show server start date and time on a page.
This commit is contained in:
parent
5c16576fa4
commit
9ac60e9f28
@ -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)
|
||||
}
|
||||
|
@ -46,8 +46,6 @@ 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"`
|
||||
@ -72,8 +70,6 @@ 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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user