Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Solved Why my item (Next page) is always listed as first instead of last item in the list
#1
i create a list
with first for argument and after i want to add an item with an if argument

python:
def channelLevel():

    try:
        data = load_channels.getAllChannels(portal['mac'], portal['url'], portal['serial'], addondir)

    except Exception as e:
        xbmcgui.Dialog().notification(addonname, str(e), xbmcgui.NOTIFICATION_ERROR )
        return

    data = data['channels']
    items = len(data)
    #xbmcgui.Dialog().notification(addonname, str(items), xbmcgui.NOTIFICATION_ERROR )

    for i in data:
        name        = i["name"]
        cmd         = i["cmd"]
        tmp         = i["tmp"]
        number      = i["number"]
        genre       = i["genre"]
        logo        = i["logo"]
        id          = i["id"]
        page        = i["page"]
        pages        = i["pages"]
        
        
        url = build_url({
            'mode': 'check', 
            'cmd': cmd,
            'title' : name,
            'logo' : logo,  
            'portal' : json.dumps(portal)
            })
        
        li = xbmcgui.ListItem(name)
        li.setArt({'icon':logo})
        li.setInfo(type='Video', infoLabels={ 
            'title': name,
            'count' : number,
            #'plot' : load_channels.getShortEPG(portal['mac'], portal['url'], portal['serial'], addondir, epgid),
            })
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
    

            
    xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
    xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_PROGRAM_COUNT)
    
    if items == 14:
        url = build_url({
            'mode': 'channels',
            'page' : page,
            'genre_id' : genre,
            'logo' : icon3,  
            'portal' : json.dumps(portal)
            })
        li = xbmcgui.ListItem('Next Page>> '+str(page)+'/'+str(pages))
        li.setArt({'icon':icon3})
        
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)

but li = xbmcgui.ListItem('Next Page>> '+str(page)+'/'+str(pages))
always is on the first position of the list
what i have to change to have this item as last item in the list...

sorry for most i thing this is a stupid question but like i told befor i am not a programmer  Sad

thanks for helping me
Reply
#2
found solution...not perfect but works...
i removed 

xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_TITLE)
xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_PROGRAM_COUNT)

from the code
Reply
#3
Thread marked solved.
Reply

Logout Mark Read Team Forum Stats Members Help
Why my item (Next page) is always listed as first instead of last item in the list0
This forum uses Lukasz Tkacz MyBB addons.