From 99fb7cd7a5d2960420093346637085a54e72e35d Mon Sep 17 00:00:00 2001 From: kvanzuijlen Date: Sun, 12 Jul 2020 12:23:32 +0200 Subject: [PATCH] Added a parameter to choose whether to include now playing or not --- src/pylast/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 938cc7b..b0a49c5 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -2355,7 +2355,7 @@ class User(_BaseObject, _Chartable): return Track(artist, title, self.network, self.name, info=info) - def get_recent_tracks(self, limit=10, cacheable=True, time_from=None, time_to=None, stream=True): + def get_recent_tracks(self, limit=10, cacheable=True, time_from=None, time_to=None, stream=True, now_playing=False): """ Returns this user's played track as a sequence of PlayedTrack objects in reverse order of playtime, all the way back to the first track. @@ -2394,7 +2394,7 @@ class User(_BaseObject, _Chartable): params, stream=stream ): - if track_node.hasAttribute("nowplaying"): + if track_node.hasAttribute("nowplaying") and not now_playing: continue # to prevent the now playing track from sneaking in if limit and track_count >= limit: