Updated CheckAndUpdateMostListenedSong() to work with a new Song struct.
This commit is contained in:
parent
58b3d18288
commit
bd9b80076a
@ -47,15 +47,14 @@ 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) {
|
||||
if prev.Song == "" {
|
||||
if prev.Artist == "" {
|
||||
return
|
||||
}
|
||||
l, _ := strconv.Atoi(cur.Listeners)
|
||||
if l > mostListened.Listeners {
|
||||
if cur.MaxListeners > mostListened.Listeners {
|
||||
mostListened = MostListenedSong{
|
||||
Listeners: l,
|
||||
Listeners: cur.MaxListeners,
|
||||
Date: time.Now().UTC(),
|
||||
Song: prev.Song}
|
||||
Song: prev.ArtistTitle()}
|
||||
}
|
||||
mlsChanged = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user