In CheckAndUpdateMostListenedSong pass cur and prev songs by pointer.
This commit is contained in:
parent
2cf6e1a6cb
commit
e8ad10a16d
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user