Kodi Community Forum

Full Version: What is the behaviour of xbmcplugin.addSortMethod ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yet another stupid question.

I have the following in an addon:
xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_GENRE)

Using Gotham Alpha6, when I try to change the sort method on the sidebar menu, I can't change it from "Default", the mouse/keyboard won't focus on "Sort by:".
Tried a couple of skins and it behaves the same in all. Went back to 12.2 and seems the same.
If I get rid of the addSortMethod for UNSORTED, all is well and I can change the sort method.

If I move the addSortMethod for UNSORTED from the the first call position, I can change Sort By until I select default (UNSORTED). After that I can't select a different sort method in same way as described above.
Is this the intended behaviour?

Thanks
Does anyone know the answer to above? I also experience the same issue when SORT_METHOD_NONE is in the list. I'm trying to maintain some older addons which use this. The issue exists in Gotham 13.1 as well.
Yes, that is by design. SORT_METHOD_NONE or SORT_METHOD_UNSORTED mean you don't have any sort methods. i.e. XBMC won't attempt to change the sort mode if that's what it's currently on.
(2014-05-17, 04:03)jmarshall Wrote: [ -> ]Yes, that is by design. SORT_METHOD_NONE or SORT_METHOD_UNSORTED mean you don't have any sort methods. i.e. XBMC won't attempt to change the sort mode if that's what it's currently on.

Ok Thanks. I was confused because there are several addons in the xbmc.org repo that add UNSORTED to a list of sort methods (like I show in the first post), so I thought that it would just be displayed in the order in which the items were inserted into the list (I was wondering how you would get back to that order if you specified a sort then went back to unsorted). To be clear: if one uses SORT_METHOD_NONE or SORT_METHOD_UNSORTED it should be the only method in the list?

Lastly, what is the scope of the addSortMethod routine, is it the directory items which are added subsequent to the call, all the directories in the addon, all directories in any addon until the next addSortMethod, or something else?
Thanks.
It applies to the one list only.