Issue with Kodi 19.3 JSON API and sorting order of movies inside movie sets
#1
Hi,

a user of the iOS remote App noticed a problem which seems the be caused by Kodi server. When requesting a list of movies filtered for a movie set, and requesting to sort for "year", the resulting list is still sorted by "label":

Request:
{"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","id":1,"params":{"filter":{"setid":5},"properties":["year"],"sort":{"order":"ascending","method":"year","ignorearticle":false}}}

Response:
{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":3,"start":0,"total":3},"movies":[{"label":"Angel Has Fallen","movieid":44,"year":2019},{"label":"London Has Fallen","movieid":45,"year":2016},{"label":"Olympus Has Fallen","movieid":23,"year":2013}]}}

Can someone else confirm this problem or comment on this?
Reply
#2
i can confirm..
only a guess, but i think year is the 2nd sort criteria and label is the first (because that field is always returned). otherwise the ignorearticle property wouldn't make much sense.
though the sorting in Kodi is quite complicated, just tried to trace that json call and see what's going on there..... Huh
maybe @DaveBlake can shed a light on this?
Reply
#3
(2022-01-06, 00:22)howie-f Wrote: only a guess, but i think year is the 2nd sort criteria and label is the first (because that field is always returned). otherwise the ignorearticle property wouldn't make much sense.
though the sorting in Kodi is quite complicated, just tried to trace that json call and see what's going on there..... Huh
Nothing special about how sorting is done for JSON results, it uses the same code as for the results displayed on UI. Here https://github.com/xbmc/xbmc/blob/a795c1...s.cpp#L227

You can add ignorearticle to any sort (the interface is not that fussy) but it only applies to specific fields when they are part of the sort criteria. Most sort orders use more than one field even if the name is a single field.

In particular ByYear uses AirDate + Year + Album + track + label, so for example albums would get returned by year and album title.

Since what you are seeing for movies is results by label and not year my first guess would be that either the year field is not being populated for some reason or that the AirDate field is not null. @howie-f  examining values in the area of code I link when using movie set filter could show more.
Reply
#4
(2022-01-07, 11:53)DaveBlake Wrote: examining values in the area of code I link when using movie set filter could show more.

yes thanks. just set a breakpoint there and end up with the following labels
"0 Angel Has Fallen", "0 London Has Fallen", "0 Olympus...", while FieldAirDate holds a null-value and FieldYear has 0 (the number).
i assume either the one or the other field needs to be populated for this to work..  and if both are set we would end up with "dd.mm.yyyy YYYY label".
Reply
#5
potential fix is here https://github.com/xbmc/xbmc/pull/20832
Reply
#6
Thanks for sharing this update. This means sorting by year went wrong for movies in general, not only when filtered for movie sets?
Reply
#7
(2022-01-10, 13:24)Buschel Wrote: This means sorting by year went wrong for movies in general, not only when filtered for movie sets?

yup, that's what it means. long lasting bug and a nice find. fingers crossed it is resolved properly (most likely it is)
Reply
#8
Since I was the one who initially reported this issue in the iOS App thread, I would like to thank you all for your efforts in debugging and fixing this.
Great work, highly appreciated.
Reply

Logout Mark Read Team Forum Stats Members Help
Issue with Kodi 19.3 JSON API and sorting order of movies inside movie sets0