context menu
#1
How do i add something in the context menu

cause i want to add like add to favourites or record or delete ?

and how do i assign a action to the context menu
Reply
#2
You can add your own context menu entries by calling listitem.addContextMenuItems(items)
Where items needs to be a list of two-tuple-elements (title, action).
Example:
Code:
contextMenuItems = []
contextMenuItems.append(
    ('Title foo bar', 'XBMC.RunScript(Plugin URL foo bar)')
)
listitem.addContextMenuItems(contextMenuItems, True)

Action can be any XBMC Builtin Actions like "XBMC.RunScript()" or "Queue(item)" or whatever.
The second parameter is replaceItems.

Just have a look to the code of other add-ons.

regards,
sphere
My GitHub. My Add-ons:
Image
Reply
#3
whats going on ? global name listitem not defined i thought it was part of xbmcgui


Code:
contextMenuItems = []                                            
            contextMenuItems.append(('Add Favorite Channel', 'XBMC.RunPlugin(plugin://plugin.video.FilmOn/?url='+str(url)+'&mode=10&name=&iconimage=&description='))
            ListItem.addContextMenuItems(contextMenuItems, True)
Reply
#4
You need to call the "addContextMenuItems"-Method to _your_ instance of ListItem.
If you want to add context menu entries on all of your items you also need to to call the method on every item!

Maybe have instanced it as "li" or "liz"?
My GitHub. My Add-ons:
Image
Reply

Logout Mark Read Team Forum Stats Members Help
context menu0