From 13bdb15af90deba45c39552fa1ab1b56ca9ec6f1 Mon Sep 17 00:00:00 2001 From: Pedro de Oliveira Date: Mon, 10 Feb 2020 16:24:30 +0000 Subject: [PATCH] Fix when not REALLY currently playing, but played a few minutes ago --- LastFM/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LastFM/plugin.py b/LastFM/plugin.py index f31de8f..d4ded70 100644 --- a/LastFM/plugin.py +++ b/LastFM/plugin.py @@ -246,7 +246,7 @@ class LastFM(callbacks.Plugin): ts_now = int(time.time()) diff = ts_now - ts_track if diff <= 300: # Listened to anything in the last 5 minutes - track = track.track + track = pylast.Track(track.track.artist, track.track.title, self.network, username) else: track = None else: @@ -274,7 +274,9 @@ class LastFM(callbacks.Plugin): if track.get_userloved(): lovemsg = self.loved - playcount = userinfo.get_now_playing().get_userplaycount() + playcount = track.get_userplaycount() + if not playcount: + playcount = 0 message = "{} {} is listening to: {} {}({} plays) {}".format( self.prepend,