v18 xbmcplugin.addDirectoryItems display the same items twice
#1
i have make a function to display a list but i'm getting the double of items .Each item is displayed twice 
if somebody can help PLS
def additems2( items,handle, folder=True,view_mode=None, is_update=False, cacheToDisc=True):
      items_list = []
      for item in items:
                li = xbmcgui.ListItem(item['label'],  iconImage=item['iconImage'],
                              thumbnailImage=item['thumbnail'])

        
        li.setArt({"poster": item['poster'], "icon": item['iconImage'],
                        "fanart" : item["fanart"]})

        cleaned_info = clean_dict(item.get('info'))
        if cleaned_info:
            li.setInfo('video', cleaned_info)

        if item.get('is_playable'):
            li.setProperty('IsPlayable', 'true')
                
        if item.get('context_menu'):
            li.addContextMenuItems(item['context_menu'])
                
        if item.get('info'):
            for key, val in item.get('info'):
                li.setProperty(key, val)
        items_list.append((item.get('url'), li,True))

      xbmc.log('len(items_list {}'.format(len(items_list)))
      xbmcplugin.addDirectoryItems(handle, items_list,len(items_list))
Reply
#2
(2019-11-20, 03:02)kabcasa Wrote: i have make a function to display a list but i'm getting the double of items .Each item is displayed twice 
if somebody can help PLS
def additems2( items,handle, folder=True,view_mode=None, is_update=False, cacheToDisc=True):
      items_list = []
      for item in items:
                li = xbmcgui.ListItem(item['label'],  iconImage=item['iconImage'],
                              thumbnailImage=item['thumbnail'])

        
        li.setArt({"poster": item['poster'], "icon": item['iconImage'],
                        "fanart" : item["fanart"]})

        cleaned_info = clean_dict(item.get('info'))
        if cleaned_info:
            li.setInfo('video', cleaned_info)

        if item.get('is_playable'):
            li.setProperty('IsPlayable', 'true')
                
        if item.get('context_menu'):
            li.addContextMenuItems(item['context_menu'])
                
        if item.get('info'):
            for key, val in item.get('info'):
                li.setProperty(key, val)
        items_list.append((item.get('url'), li,True))

      xbmc.log('len(items_list {}'.format(len(items_list)))
      xbmcplugin.addDirectoryItems(handle, items_list,len(items_list))

It happens all the time? Im asking cuz sometimes (very rare) it happens to me to have doubled itens listed
Reply
#3
yes all the time for me
Reply
#4
(2019-11-20, 03:50)kabcasa Wrote: yes all the time for me

how do u call this function (additems2)?
Reply
#5
(2019-11-20, 16:49)Rick987 Wrote:
(2019-11-20, 03:50)kabcasa Wrote: yes all the time for me

how do u call this function (additems2)? 
like this :
additems2( items,int(int(sys.argv[1])), folder=True,view_mode='movies', is_update=False, cacheToDisc=True)
Reply
#6
(2019-11-20, 20:18)kabcasa Wrote:
(2019-11-20, 16:49)Rick987 Wrote:
(2019-11-20, 03:50)kabcasa Wrote: yes all the time for me

how do u call this function (additems2)?  
like this :
additems2( items,int(int(sys.argv[1])), folder=True,view_mode='movies', is_update=False, cacheToDisc=True) 
I didnt test ur code but it doesnt seem to be wrong, maybe the list u are sending could be duplicated?
additems2( items,int(int(sys.argv[1])), folder=True,view_mode='movies', is_update=False, cacheToDisc=True)
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcplugin.addDirectoryItems display the same items twice0