From e8ad10a16d17de7b879cce5b25c80273e2c786bb Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Fri, 15 Sep 2023 03:17:44 +0400 Subject: [PATCH] In CheckAndUpdateMostListenedSong pass cur and prev songs by pointer. --- internal/radio/icecast.go | 2 +- internal/radio/mostlistened.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index 88cd322..3c6ca44 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -198,7 +198,7 @@ func (pw *PlaylistLogWatcher) Watch(playlistPath string, n int) (err error) { lastPlayedCacheMutex.Lock() songs, err := icecastLastPlayedSongs(playlistPath, 1) if err == nil && len(songs) > 0 { - CheckAndUpdateMostListenedSong(songs[0], currentlyPlaying) + CheckAndUpdateMostListenedSong(song, ¤tlyPlaying) if currentlyPlaying.Time == "" { currentlyPlaying = songs[0] } else { diff --git a/internal/radio/mostlistened.go b/internal/radio/mostlistened.go index ce7c430..7d5a8ee 100644 --- a/internal/radio/mostlistened.go +++ b/internal/radio/mostlistened.go @@ -34,7 +34,7 @@ var mostListened MostListenedSong // // So it would be fairer to give these listeners back to a song they was // listening to. -func CheckAndUpdateMostListenedSong(cur, prev Song) { +func CheckAndUpdateMostListenedSong(cur, prev *Song) { if prev.Song == "" { return }