2014-03-27, 17:57
Hi
I'm porting the argenteam addon to work as a service, so far so good.
The problem that I'm having is that when I set the list of subtitles to show on the results list, I'm not able to set the corrected order.
I'm using the following code:
the list "items" is sorted correctly, I checked that using print to see if values are modified. But once I added to the plugin, they are shown in other order.
What could be wrong?
I'm porting the argenteam addon to work as a service, so far so good.
The problem that I'm having is that when I set the list of subtitles to show on the results list, I'm not able to set the corrected order.
I'm using the following code:
Code:
def append_subtitle(items):
items.sort(key=lambda x: x['rating'], reverse=True)
for item in items:
listitem = xbmcgui.ListItem(label=item['lang'],
label2=item['filename'],
iconImage=item['rating'],
thumbnailImage=item['image'])
#listitem.setProperty("sync", 'true' if item["sync"] else 'false')
#listitem.setProperty("hearing_imp", 'true' if item["hearing_imp"] else 'false')
## below arguments are optional, it can be used to pass any info needed in download function
## anything after "action=download&" will be sent to addon once user clicks listed subtitle to downlaod
url = "plugin://%s/?action=download&link=%s&filename=%s&id=%s" % (__scriptid__,
item['link'],
item['filename'],
item['id'])
## add it to list, this can be done as many times as needed for all subtitles found
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False)
the list "items" is sorted correctly, I checked that using print to see if values are modified. But once I added to the plugin, they are shown in other order.
What could be wrong?