Kodi Community Forum

Full Version: AudioLibrary.GetAlbums and GetSongs with limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just a heads up that I have spotted a bug with AudioLibrary.GetAlbums and to a lesser extent GetSongs. There is a PR to fix 9809 (PR) and I will get a build on the mirrors if anyone cares to test it out.

When some albums have multiple artists AudioLibrary.GetAlbums with limits, whether sorted or not, can result in too few albums being returned. Similarly when some songs have multiple artists AudioLibrary.GetSongs with limits and a sort order, and returning artist data (such as "artist", "artistid", or "musicbrainzartistid"), can result in too few songs being returned.

This issue was introduced in Jarvis when correcting the return of inconsistent artist data by querying with a join to the artist table. The limits issue was noticed but not fully resolved for GetSongs by subsequent fixes, while the problems with limits in GetAlbums was overlooked.

Test GetSongs with a limit over a range of songs that have multiple artists, sorting by something and artist properties e.g.
Code:
{"jsonrpc":"2.0","id":1,"method":"audioLibrary.GetSongs","params":{"limits": {"start":20, "end":30}, "sort":{"order":"ascending","method":"artist","ignorearticle":true},"properties":["artist"]}}}

Test GetAlbums with a limit over a range of albums that have multiple artists, both with and without sorting e.g.
Code:
{"jsonrpc":"2.0","id":1,"method":"audioLibrary.GetAlbums","params":{"limits": {"start":20, "end":30}, "sort":{"order":"ascending","method":"artist","ignorearticle":true},"properties":["artist"]}}}

and

Code:
{"jsonrpc":"2.0","id":1,"method":"audioLibrary.GetAlbums","params":{"limits": {"start":20, "end":30}, "properties":["artist"]}}}

The "artist" property is irrelevent to the problem in GetAlbums here but useful to see what is happening.

In both GetSongs and GetAlbums when the limit goes wrong it is because it is being applied to the count of records in a join with artist data, hence a row per artist per song/album, so important to test using a range of songs or albums with multiple artists.

Test build available here http://mirrors.kodi.tv/test-builds/win32...9-HEAD.exe