Posts: 2
Joined: Mar 2017
Reputation:
0
Hey Guys,
i want to add a list item which does not start a video but starts a function from my python code instead. Is that possible ?
Thanks,
Thorsten
Posts: 12,461
Joined: Oct 2014
Reputation:
601
Thread moved to add-on development
Posts: 1,663
Joined: Jun 2011
Reputation:
119
Set isFolder=False but do not touch 'isPlayable' property and you can do whatever you want within that plugin call.
Posts: 2
Joined: Mar 2017
Reputation:
0
Ok, i have this structure now:
li = xbmcgui.ListItem("Start a function")
xbmcplugin.addDirectoryItem(handle=addon_handle, listitem=li, isFolder=False, isPlayable = False)
But how can I give the entry a function as a parameter for the event? I think, it has no command function like a button in tkinter for example.
Posts: 261
Joined: Mar 2015
Reputation:
24
thorsten,
liz=xbmcgui.ListItem(label="title seen by the user")
liz.setProperty('IsPlayable', 'true') #value must be a string
xbmcplugin.addDirectoryItem(pluginhandle, "plugin://plugin.video.youraddon?command=command1&arg1=something&arg2=something", listitem=liz, isFolder=False)
command, arg1, arg2, etc are your own definitions for your plugin. it can be any string.
many addons make a function called addDir to handle the addDirectoryItem part to make things easier.
IIRC
setting isPlayable to 'false' with isFolder=False
results in pluginhandle=-1 (you get invalidhandle error if you need to use a function that requires a pluginhandle)