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()
|
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, ¤tlyPlaying)
|
||||||
if currentlyPlaying.Time == "" {
|
if currentlyPlaying.Time == "" {
|
||||||
currentlyPlaying = songs[0]
|
currentlyPlaying = songs[0]
|
||||||
} else {
|
} else {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user