2019-03-21, 08:16
Okay, this really shouldn't be as difficult as it is... All of the info is years old and there is plenty of it conflicting.
Firstly, I have noticed that there are two lists. One is SortUtils.h, which seems to carry the IDs for Container.SetSortMethod(). The other is SortFileItem.h, which has its values copied to xbmcplugin.py and is used to add sort methods to a ListItem. They are different, and that's really aggravating for one thing, but I understand that you guys are busy, breaking API...okay you guys seem fine with that one lately if it has more benefits than drawbacks, and migrating enums that aren't exactly 1 to 1 is just a pain.
What I am trying to do:
I build a list. I add some sort items to it. Yes, these items are pretty simple and from what I can tell, they work. Things stop going smoothly from here.
I built this Beautiful Class that does the mapping for me. Based on certain conditions, a script calls string2id.get(name) and feeds it to 'Container.SetSortMethod(id)'. This should work, I think. The issue is that it sometimes works.... I can't set some of the sorting IDs for Container.SetSortMethod(). The one in particular that I noticed is not working is Episode. The container ID should be 23 and the listitem ID should be 24. It gets added to the sort list, but it isn't selected. It seems to select 'Date', but not the same 'Date' that is already there. Selecting it manually does work.
Any input would be useful. I would prefer not to change the order in which I add things to the Sort List.
Firstly, I have noticed that there are two lists. One is SortUtils.h, which seems to carry the IDs for Container.SetSortMethod(). The other is SortFileItem.h, which has its values copied to xbmcplugin.py and is used to add sort methods to a ListItem. They are different, and that's really aggravating for one thing, but I understand that you guys are busy, breaking API...okay you guys seem fine with that one lately if it has more benefits than drawbacks, and migrating enums that aren't exactly 1 to 1 is just a pain.
What I am trying to do:
I build a list. I add some sort items to it. Yes, these items are pretty simple and from what I can tell, they work. Things stop going smoothly from here.
I built this Beautiful Class that does the mapping for me. Based on certain conditions, a script calls string2id.get(name) and feeds it to 'Container.SetSortMethod(id)'. This should work, I think. The issue is that it sometimes works.... I can't set some of the sorting IDs for Container.SetSortMethod(). The one in particular that I noticed is not working is Episode. The container ID should be 23 and the listitem ID should be 24. It gets added to the sort list, but it isn't selected. It seems to select 'Date', but not the same 'Date' that is already there. Selecting it manually does work.
I add items to the sort list like so. The directory content type is 'episodes'. It is filled with playable items, and the infolabels are all set as needed.python:
xbmcplugin.addSortMethod(handle, Sorting.none.listitem_id)
xbmcplugin.addSortMethod(handle, Sorting.episode_number.listitem_id)
xbmcplugin.addSortMethod(handle, Sorting.date.listitem_id)
xbmcplugin.addSortMethod(handle, Sorting.title.listitem_id)
xbmcplugin.addSortMethod(handle, Sorting.rating.listitem_id)
xbmcplugin.addSortMethod(handle, Sorting.year.listitem_id)
Any input would be useful. I would prefer not to change the order in which I add things to the Sort List.