Added a parameter to choose whether to include now playing or not

This commit is contained in:
kvanzuijlen 2020-07-12 12:23:32 +02:00 committed by Koen van Zuijlen
parent 11d955dd89
commit 99fb7cd7a5

View file

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