1
0

In CheckAndUpdateMostListenedSong pass cur and prev songs by pointer.

This commit is contained in:
Alexander Andreev 2023-09-15 03:17:44 +04:00
parent 2cf6e1a6cb
commit e8ad10a16d
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 2 additions and 2 deletions

View File

@ -198,7 +198,7 @@ func (pw *PlaylistLogWatcher) Watch(playlistPath string, n int) (err error) {
lastPlayedCacheMutex.Lock() lastPlayedCacheMutex.Lock()
songs, err := icecastLastPlayedSongs(playlistPath, 1) songs, err := icecastLastPlayedSongs(playlistPath, 1)
if err == nil && len(songs) > 0 { if err == nil && len(songs) > 0 {
CheckAndUpdateMostListenedSong(songs[0], currentlyPlaying) CheckAndUpdateMostListenedSong(song, &currentlyPlaying)
if currentlyPlaying.Time == "" { if currentlyPlaying.Time == "" {
currentlyPlaying = songs[0] currentlyPlaying = songs[0]
} else { } else {

View File

@ -34,7 +34,7 @@ var mostListened MostListenedSong
// //
// So it would be fairer to give these listeners back to a song they was // So it would be fairer to give these listeners back to a song they was
// listening to. // listening to.
func CheckAndUpdateMostListenedSong(cur, prev Song) { func CheckAndUpdateMostListenedSong(cur, prev *Song) {
if prev.Song == "" { if prev.Song == "" {
return return
} }