2013-08-11, 17:43
Hi, new to forums but long time XBMC user. My Python is ok but I am struggling to get my head around the xbmcgui API. Trawling google has lead me to write the following (very simple) test script:
I was hoping this would bring up a menu screen with one option 'TestCaption' (obviously going nowhere at this stage) .
When I select my addon, I get a script failure - any help appreciated.[/code]
Code:
import xbmcaddon, xbmc, xbmcgui
def addMenuItem(caption, link, icon=None, thumbnail=None, folder=False):
listItem = xbmcgui.ListItem(unicode(caption), iconImage=icon, thumbnailImage=thumbnail)
listItem.setInfo(type="Video", infoLabels={ "Title": caption })
return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=listItem, isFolder=folder)
def endListing():
xbmcplugin.endOfDirectory(int(sys.argv[1]))
addMenuItem('TestCaption','/')
endListing()
I was hoping this would bring up a menu screen with one option 'TestCaption' (obviously going nowhere at this stage) .
When I select my addon, I get a script failure - any help appreciated.[/code]