xbmcplugin.addDirectoryItem -- Another Action than play Video
#1
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
Reply
#2
(2017-03-22, 14:32)thorsten81 Wrote: 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

If you want to create a addDirectoryItem that does not start playback simply set "isFolder" to True, and setProperty('IsPlayable', 'false').

http://mirrors.xbmc.org/docs/python-docs...ectoryItem

http://kodi.wiki/view/HOW-TO_write_plugins_for_XBMC
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
Thread moved to add-on development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#4
Set isFolder=False but do not touch 'isPlayable' property and you can do whatever you want within that plugin call.
Reply
#5
(2017-03-23, 09:15)Roman_V_M Wrote: Set isFolder=False but do not touch 'isPlayable' property and you can do whatever you want within that plugin call.

If you don't mind me asking... what is the harm in setting isPlayable false? I understand its not needed to achieve the OPS goal, but if it were set to true by accident it would negate his intention, which is why I included it.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#6
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.
Reply
#7
(2017-03-23, 14:56)Lunatixz Wrote:
(2017-03-23, 09:15)Roman_V_M Wrote: Set isFolder=False but do not touch 'isPlayable' property and you can do whatever you want within that plugin call.

If you don't mind me asking... what is the harm in setting isPlayable false? I understand its not needed to achieve the OPS goal, but if it were set to true by accident it would negate his intention, which is why I included it.

Sorry, somehow I've missed your reply (bad day). I guess It does not matter.
Reply
#8
(2017-03-23, 15:31)thorsten81 Wrote: 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.

Observe xbmcplugin.addDirectoryItem signature. 'isPlayable' property belongs to ListItem. As for passing parameters, you need to do it the same way as with other types of plugin calls: via plugin call URL/query string.
Reply
#9
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)
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcplugin.addDirectoryItem -- Another Action than play Video0