Use paging to get all 'limit' items for Artist.get_top_albums (and others using _get_things)

This commit is contained in:
Hugo 2018-01-11 11:36:14 +02:00
parent 22e03705c4
commit 309b156fca

View file

@ -1046,11 +1046,14 @@ class _BaseObject(object):
self, method, thing, thing_type, params=None, cacheable=True): self, method, thing, thing_type, params=None, cacheable=True):
"""Returns a list of the most played thing_types by this thing.""" """Returns a list of the most played thing_types by this thing."""
doc = self._request( limit = params.get("limit", 1)
self.ws_prefix + "." + method, cacheable, params)
seq = [] seq = []
for node in doc.getElementsByTagName(thing): for node in _collect_nodes(
limit,
self,
self.ws_prefix + "." + method,
cacheable,
params):
title = _extract(node, "name") title = _extract(node, "name")
artist = _extract(node, "name", 1) artist = _extract(node, "name", 1)
playcount = _number(_extract(node, "playcount")) playcount = _number(_extract(node, "playcount"))