Prior99 / mopidy-subidy

Mopidy extension for playing music from Subsonic servers.
BSD 3-Clause "New" or "Revised" License
30 stars 12 forks source link

Make repeated getAlbumList2 requests with offset to get all albums #33

Closed brynedwards closed 3 years ago

brynedwards commented 4 years ago

Fixes #30. As I mentioned in #30, even though supysonic ignores the spec's album size limit of 500, there's no guarantee all subsonic server implementations will ignore it so it's better to make repeat requests

brynedwards commented 4 years ago

To try and clear up what this is doing and why:

Subsonic doesn't offer a way to retrieve the total number of albums, and the Subsonic API (according to spec anyway) limits the results to 500. The ideal way would be to have a paginated listing of albums but Mopidy doesn't support this yet (see mopidy/mopidy#733). So, until then, we get all the albums by getting 500 at a time with each get_more_albums() call, and, if we don't get 500 albums in the response, we assume we've gotten all the albums and we return our total. This is going to involve multiple API calls, basically one for each multiple of 500, and possibly one extra if the server contains a multiple of 500. So for example 2000 albums would mean 4 calls for each set of 500 and then, because the 4th call returns 500 albums we'd make a 5th call which would return 0. We can't know this because we just don't know how many albums we'd have to get.

codecov-io commented 4 years ago

Codecov Report

Merging #33 (584209c) into master (89093e7) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #33   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           6       6           
  Lines         573     583   +10     
======================================
- Misses        573     583   +10     
Impacted Files Coverage Δ
mopidy_subidy/subsonic_api.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 89093e7...584209c. Read the comment docs.