Solved Subtitle list not being ordered as requested
#1
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:

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?
Reply
#2
I noticed it too. Xbmc (re)orders by path source code. In this case Path is (action) url.
But I have a workaround: source code I manualy added an 'actionsortorder' query param to get the proper sort order on the UI.
These aren’t the droids you’re looking for...
Reply
#3
Thanks!!!! That did the trick!!
Reply

Logout Mark Read Team Forum Stats Members Help
Subtitle list not being ordered as requested0