From 309b156fca6811225a5ad7e027e69e5aa9e4df3d Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 11 Jan 2018 11:36:14 +0200 Subject: [PATCH] Use paging to get all 'limit' items for Artist.get_top_albums (and others using _get_things) --- pylast/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index 4ba99a4..3252c96 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1046,11 +1046,14 @@ class _BaseObject(object): self, method, thing, thing_type, params=None, cacheable=True): """Returns a list of the most played thing_types by this thing.""" - doc = self._request( - self.ws_prefix + "." + method, cacheable, params) - + limit = params.get("limit", 1) seq = [] - for node in doc.getElementsByTagName(thing): + for node in _collect_nodes( + limit, + self, + self.ws_prefix + "." + method, + cacheable, + params): title = _extract(node, "name") artist = _extract(node, "name", 1) playcount = _number(_extract(node, "playcount"))