From f960d8516afeb891ec3e8009652ea4922800f1c0 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 8 Oct 2023 23:55:55 +0400 Subject: [PATCH] Since SongList.Current() now return a copy then this code is no longer needed. --- internal/http/dj_handlers.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/http/dj_handlers.go b/internal/http/dj_handlers.go index ac332ea..42976f3 100644 --- a/internal/http/dj_handlers.go +++ b/internal/http/dj_handlers.go @@ -100,18 +100,13 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) { func (dj *DJHandlers) Status(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - var curSong *radio.Song = nil - if dj.songList.Current() != nil { - curSong = &radio.Song{} - *curSong = *dj.songList.Current() - } err := json.NewEncoder(w).Encode(&struct { Current *radio.Song `json:"current_song,omitempty"` Listeners *radio.ListenerCounter `json:"listeners"` List []radio.Song `json:"last_songs,omitempty"` Mls *radio.MostListenedSong `json:"most_listened_song,omitempty"` }{ - Current: curSong, + Current: dj.songList.Current(), Listeners: dj.listeners, List: dj.songList.List(), Mls: dj.mostLSong.Get()})