1
0

Updated CheckAndUpdateMostListenedSong() to work with a new Song struct.

This commit is contained in:
Alexander Andreev 2023-10-02 03:19:23 +04:00
parent 58b3d18288
commit bd9b80076a
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -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
}