2013-09-05, 16:31
I'm working on my first AddOn. Everything works so far, with one exception: I would like to display additional information for each listitem. Much like the episode count in the list of tvshows. But I can't get that to work.
I took all the functionality out of the plugin to have the simplest possible code to present here:
I've tried several thing such as setting a sortorder or the label2Mask, but nothing helped.
I have even modified the ViewsFileMode.xml of Confluence by adding some decorations around $INFO[ListItem.Label] and $INFO[ListItem.Label2] in order to make sure both are actually referenced in the skin. But whatever I tried, the value of ListItem.Label2 was empty in the skin.
What am I doing wrong?
I took all the functionality out of the plugin to have the simplest possible code to present here:
Code:
import sys
import xbmc, xbmcgui, xbmcplugin
import xbmcaddon
# plugin handle
handle = int(sys.argv[1])
# utility functions
def addDirectoryItem(name, isFolder=True, parameters={}, url='',icon='',label2='Bla'):
''' Add a list item to the XBMC UI.'''
li = xbmcgui.ListItem(label=name,label2=label2,iconImage=icon)
if url=='':
url = sys.argv[0] + '?' + urllib.urlencode(parameters)
return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=li, isFolder=isFolder)
# UI builder functions
def show_root_menu():
addDirectoryItem(name='Something', url='videodb://2/2/1/1',isFolder=True, label2='Add. info')
addDirectoryItem(name='Something else', url='videodb://2/2/2/1',isFolder=True, label2='Other info')
xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
ok = show_root_menu()
I have even modified the ViewsFileMode.xml of Confluence by adding some decorations around $INFO[ListItem.Label] and $INFO[ListItem.Label2] in order to make sure both are actually referenced in the skin. But whatever I tried, the value of ListItem.Label2 was empty in the skin.
What am I doing wrong?