2011-01-13, 03:32
I had also noticed that GetAlbums does the limit first, then the sorting. That is to say, if you specify start 0 and end 10 with sort ascending then it returns the first 10 albums it finds in the database and then sorts them. Those 10 albums are sorted by albumid I think. This behaviour can be demonstrated by doing a second query with a start of 10, end of 20 and comparing the results. It won't be the next 10 albums in alphabetical order.
GetArtists does it correctly, but at the very high cost of querying the database for ALL artists, then sorting and applying the limit.
Neither way is right... in an ideal world the sorting/limiting should be done by the database, not the libjson code. But that would require changes to the database code, outside of libjsonrpc.
This also leads to an inconsistency in the "total" parameter returned by libjsonrpc: For GetAlbums with start 0 and end 10 it will return 10, for GetArtists it will return the number of Artists in the database. I opened a Trac ticket for the totals problem in September (http://trac.xbmc.org/ticket/10146)
GetArtists does it correctly, but at the very high cost of querying the database for ALL artists, then sorting and applying the limit.
Neither way is right... in an ideal world the sorting/limiting should be done by the database, not the libjson code. But that would require changes to the database code, outside of libjsonrpc.
This also leads to an inconsistency in the "total" parameter returned by libjsonrpc: For GetAlbums with start 0 and end 10 it will return 10, for GetArtists it will return the number of Artists in the database. I opened a Trac ticket for the totals problem in September (http://trac.xbmc.org/ticket/10146)