2011-10-22, 15:02
For the add directory i use
PHP Code:
def add_directory(self, queries, title, infoLabels={}, img='', fanart='',
total_items=0, is_folder=True):
'''
Add a directory to the list of items to be displayed by XBMC.
When selected by the user, directory will call the addon with the
query values contained in `queries`.
Args:
queries (dict): A set of keys/values to be sent to the addon when
the user selects this item.
title (str): The name to be displayed for this entry.
Kwargs:
img (str): A URL to an image file to be used as an icon for this
entry.
fanart (str): A URL to a fanart image for this entry.
total_items (int): Total number of items to be added in this list.
If supplied it enables XBMC to show a progress bar as the list of
items is being built.
is_folder (bool): if ``True`` (default), when the user selects this
item XBMC will expect the plugin to add another set of items to
display. If ``False``, the 'Loading Directory' message will not be
displayed by XBMC (useful if you want a directory item to do
something like pop up a dialog).
'''
title = self.unescape(title)
url = self.build_plugin_url(queries)
self.log_debug(u'adding dir: %s - %s' % (title, url))
listitem = xbmcgui.ListItem(title, iconImage=img,
thumbnailImage=img)
if len(infoLabels)>0:
listitem.setInfo(type="Video", infoLabels=infoLabels)
listitem.setProperty('fanart_image', fanart)
xbmcplugin.addDirectoryItem(self.handle, url, listitem,
isFolder=is_folder, totalItems=total_items)