python-tidal
python-tidal copied to clipboard
Retrieve all items / pagination support
I know that the author of this repo said that he won't accept PRs while he focuses on the release of 0.7.x, and a similar PR that fixes the issue specifically for the case of favourite tracks has already been pushed.
But it's also been almost two years since that PR, 0.7.x isn't out yet, and I really need a way to load my large playlists in mopidy.
So here's my PR. Note that it's not complete yet: it's now using _get_items
for all the (reasonable) methods that return more than one item, but it simply retrieves all the items from the source (no custom pagination support yet).
It'd be nice if the author could give us an ETA for the 0.7 release.
If he's not accepting any PRs and 0.7 will still take time, I'll work on implementing proper pagination, will fork this repo for good, and will nudge the mopidy-tidal maintainer to use my repo instead of this one. I'm also happy to rewrite/refactor it (it's only ~650 lines of code after all), or volunteer as a new maintainer if the original author doesn't have bandwidth to dedicate to the project.
If instead there are still plans to release 0.7 shortly, I'll hold on with this PR and may help speed up things on the 0.7 branch instead.
But two years after the "no PRs accepted, just wait for me to release the new version" announcement, it's fair that we may expect things to move on in a way or another.
Like i mentioned in the linked PR, it's totally possible to use the 0.7.x branch already, e.g. https://stackoverflow.com/a/54794506 (but most likely with https instead of ssh)
Also, i recently commented on the current state here: https://github.com/tamland/python-tidal/issues/31#issuecomment-1121612078, i suggest watching the repo if you don't want to miss comments like that, but yes, the plan is for a pre-release next month.
Note that i have been fixing bugs in the 0.6.x branch, but limitations like this that have existed for like 8 years already, will probably not be fixed outside 0.7.x.
Also like i mentioned in the previous PR, paginating through every item isn't great as a default.
Also like i mentioned in the previous PR, paginating through every item isn't great as a default.
I totally agree on that. As I mentioned, this PR is still WIP, and limit
/offset
should probably be passed as arguments on all the methods that return multiple items (and all of them functions should also use _get_items
instead of _make_request
, and that's been addressed in this PR).
A sensible default limit
(overridable via 0
/None
if a client needs all the items) definitely makes much more sense, but for now I just needed something to get my large collections and playlists to work.
If 0.7.x addresses pagination properly, and its release is coming up shortly, then I can hold on with this PR, temporarily use it as a workaround, and then move to 0.7.x when it's on pip
(but probably it'll take me some time to investigate if there are changes required to adopt it on mopidy-tidal
as well).
If 0.7.x will take some extra time, I'm also happy to help to get it on the door earlier.