Open GoogleCodeExporter opened 9 years ago
It seems like this version won’t work with Libre.fm since passing 0 as limit
yields an empty tracklist. The only workaround to get it working on both is
using an insanely huge number as limit.
In any case, the current version of the _collect_nodes() function should
support None as value for limit to indicate unlimited data retrieval.
Original comment by matsusuk...@gmail.com
on 19 Mar 2011 at 10:42
Unfortunately this patch doesn't work for large value of limit. Lastfm returns
error for limit=4000:
XML Parsing Error: no element found
Location:
http://ws.audioscrobbler.com/2.0/?method=library.gettracks&api_key=b25b959554ed7
6058ac220b7b2e0a026&limit=4000&user=joanofarctan
Line Number 29787, Column 45: <name>Psychometry III (Break 3000 Remix)
--------------------------------------------^
and in python:
>>> len(lib.get_tracks(limit=2000))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pylast.py", line 2030, in get_tracks
for node in _collect_nodes(limit, self, "library.getTracks", True, params):
File "pylast.py", line 3511, in _collect_nodes
doc = sender._request(method_name, cacheable, params)
File "pylast.py", line 970, in _request
return _Request(self.network, method_name, params).execute(cacheable)
File "pylast.py", line 828, in execute
response = self._download_response()
File "pylast.py", line 819, in _download_response
self._check_response_for_errors(response_text)
File "pylast.py", line 838, in _check_response_for_errors
raise MalformedResponseError(self.network, e)
pylast.MalformedResponseError: Malformed response from Last.fm. Underlying
error: no element found: line 37702, column 33
Resolution from issue 63 works:
>>> len(lib.get_tracks(limit=2000))
2000
>>> len(lib.get_tracks(limit=None))
6045
I think that it's not possible to avoid using 'page' paremeter for large values
of 'limit' parameter.
Original comment by grzegorz...@gmail.com
on 20 Mar 2011 at 8:47
Yes, I can confirm that the suggested fix in issue 63 works fine as well
without breaking compatibility with Libre.fm. Ignore my suggestion then and go
with that one instead. :-)
Original comment by matsusuk...@gmail.com
on 20 Mar 2011 at 11:51
I've implemented this in my fork:
https://github.com/hugovk/pylast/issues/66
Original comment by hugovk@gmail.com
on 17 Apr 2014 at 1:52
Original issue reported on code.google.com by
matsusuk...@gmail.com
on 19 Mar 2011 at 8:37Attachments: