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
|
// 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.Artist == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l, _ := strconv.Atoi(cur.Listeners)
|
if cur.MaxListeners > mostListened.Listeners {
|
||||||
if l > mostListened.Listeners {
|
|
||||||
mostListened = MostListenedSong{
|
mostListened = MostListenedSong{
|
||||||
Listeners: l,
|
Listeners: cur.MaxListeners,
|
||||||
Date: time.Now().UTC(),
|
Date: time.Now().UTC(),
|
||||||
Song: prev.Song}
|
Song: prev.ArtistTitle()}
|
||||||
}
|
}
|
||||||
mlsChanged = true
|
mlsChanged = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user