Montellese/xbmc — pull request #8 by Montellese (2012-06-16 09:47:49+00:00)
Title: jsonrpc: make use of the new sorting and limiting functionality

This PR makes use of the new sorting and limiting functionality introduced by myself two weeks or so ago in JSON-RPC. It has the advantage that especially any limit constraints on a listing request (e.g. GetMovies) will speed up the whole process of retrieving and returning items a lot. Up until now JSON-RPC always retrieved all full-blown CFileItem objects for all the items, then did the sorting and then the limiting. With the new sorting and limiting functionality all this is already done in the database layer and JSON-RPC only retrieves the CFileItem objects that it really needs. So now JSON-RPC clients can take pagination into account as a way to minimize waiting time on loading a long list of items. Before the request time didn't decrease (significantly) when only 10 out of 1000 items were retrieved but with these changes it will decrease drastically.

Furthermore I have done some cleanup work in CVideoDatabase and CMusicDatabase by merging GetFooByWhere() and GetSortedFoo() into GetFooByWhere(). So now there's no extra method in case we want to sort in the database layer. This saves quite some duplicate code.
There's also a fix for tvshow retrieval which I didn't notice until I played around with the sorting through JSON-RPC. It doesn't cause any problem in current master but it did for the changes I made to JSON-RPC.