How to add a menu item to the EPG context menu
#1
The add-on I'm creating needs to add a custom menu item to the EPG context menu. This is similar to what I've seen the SuperFavourites add-on do. I want to extract information from the EPG selected item for my add-on to process.

Any suggestions on how to accomplish this will be greatly appreciated. I'm especially interested in a method that will be compatible with the next version of Kodi.
Reply
#2
there's an example of a context menu addon in the wiki:
https://kodi.wiki/view/Context_Item_Add-ons

i'm not sure if you can extract epg data in python though...
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
(2018-03-28, 09:40)ronie Wrote: there's an example of a context menu addon in the wiki:
https://kodi.wiki/view/Context_Item_Add-ons

i'm not sure if you can extract epg data in python though...
Thanks ronie.
You've given me an excellent starting point for my research.
Reply
#4
(2018-03-28, 13:26)jmooremcc Wrote:
(2018-03-28, 09:40)ronie Wrote: there's an example of a context menu addon in the wiki:
https://kodi.wiki/view/Context_Item_Add-ons

i'm not sure if you can extract epg data in python though...
Thanks ronie.
You've given me an excellent starting point for my research. 
I'm trying the exact same thing (to context click on an old show and have my addon look it up online). Have you found it out?
Reply
#5
(2019-03-30, 16:54)michaelarnauts Wrote:
(2018-03-28, 13:26)jmooremcc Wrote:
(2018-03-28, 09:40)ronie Wrote: there's an example of a context menu addon in the wiki:
https://kodi.wiki/view/Context_Item_Add-ons

i'm not sure if you can extract epg data in python though...
Thanks ronie.
You've given me an excellent starting point for my research.    
I'm trying the exact same thing (to context click on an old show and have my addon look it up online). Have you found it out?   
Here's what I did to add the context menu:
Python:

<extension point="kodi.context.item">
  <menu id="kodi.core.main">
    <item library="addon.py">
      <label lang="en_GB">My Menu Item</label>
      <visible>Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)</visible>
    </item>
  </menu>
</extension>

The item library is the Python module Kodi should call when your context menu item is clicked.
I also told the system that my context menu item should only be displayed if the EPG or EPG Search windows are visible.
Reply
#6
(2019-03-30, 18:09)jmooremcc Wrote:
(2019-03-30, 16:54)michaelarnauts Wrote:
(2018-03-28, 13:26)jmooremcc Wrote: Thanks ronie.
You've given me an excellent starting point for my research.    
I'm trying the exact same thing (to context click on an old show and have my addon look it up online). Have you found it out?    
Here's what I did to add the context menu:
Python:

<extension point="kodi.context.item">
  <menu id="kodi.core.main">
    <item library="addon.py">
      <label lang="en_GB">My Menu Item</label>
      <visible>Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)</visible>
    </item>
  </menu>
</extension>

The item library is the Python module Kodi should call when your context menu item is clicked.
I also told the system that my context menu item should only be displayed if the EPG or EPG Search windows are visible. 

@jmooremcc have you find a way to get more information from the listitem besides the path and the label? I would like to read get the EpgInfoTag, but there is no listitem.getEpgInfoTag() function.
Reply
#7
(2019-07-07, 13:40)michaelarnauts Wrote:
(2019-03-30, 18:09)jmooremcc Wrote:
(2019-03-30, 16:54)michaelarnauts Wrote: I'm trying the exact same thing (to context click on an old show and have my addon look it up online). Have you found it out?    
Here's what I did to add the context menu:
Python:

<extension point="kodi.context.item">
  <menu id="kodi.core.main">
    <item library="addon.py">
      <label lang="en_GB">My Menu Item</label>
      <visible>Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)</visible>
    </item>
  </menu>
</extension>

The item library is the Python module Kodi should call when your context menu item is clicked.
I also told the system that my context menu item should only be displayed if the EPG or EPG Search windows are visible.    

@jmooremcc have you find a way to get more information from the listitem besides the path and the label? I would like to read get the EpgInfoTag, but there is no listitem.getEpgInfoTag() function.   

My Python code that is activated by the context menu item extracts the following information from the EPG:
  • Program Title
  • Program Date
  • Program Start Time
  • Program Channel Number
  • Program Icon
The following code retrieves that information:
Python:

pgmTitle = xbmc.getInfoLabel('Listitem.Title')
fullPgmDate = xbmc.getInfoLabel('Listitem.Date')
pgmTime = xbmc.getInfoLabel('Listitem.StartTime')
pgmCh = xbmc.getInfoLabel('Listitem.ChannelNumberLabel')
pgmIcon = xbmc.getInfoLabel('Listitem.Icon')
Reply
#8
(2019-07-11, 18:18)jmooremcc Wrote:
(2019-07-07, 13:40)michaelarnauts Wrote:
(2019-03-30, 18:09)jmooremcc Wrote: Here's what I did to add the context menu:
Python:

<extension point="kodi.context.item">
  <menu id="kodi.core.main">
    <item library="addon.py">
      <label lang="en_GB">My Menu Item</label>
      <visible>Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)</visible>
    </item>
  </menu>
</extension>

The item library is the Python module Kodi should call when your context menu item is clicked.
I also told the system that my context menu item should only be displayed if the EPG or EPG Search windows are visible.    

@jmooremcc have you find a way to get more information from the listitem besides the path and the label? I would like to read get the EpgInfoTag, but there is no listitem.getEpgInfoTag() function.    

My Python code that is activated by the context menu item extracts the following information from the EPG:
  • Program Title
  • Program Date
  • Program Start Time
  • Program Channel Number
  • Program Icon
The following code retrieves that information:
Python:

pgmTitle = xbmc.getInfoLabel('Listitem.Title')
fullPgmDate = xbmc.getInfoLabel('Listitem.Date')
pgmTime = xbmc.getInfoLabel('Listitem.StartTime')
pgmCh = xbmc.getInfoLabel('Listitem.ChannelNumberLabel')
pgmIcon = xbmc.getInfoLabel('Listitem.Icon')
 

Cool, thanks. I also got 'Listitem.ChannelName' and 'Listitem.EndTime'.

I'm using it for a plugin here to integrate with existing addons that can display streams: https://github.com/michaelarnauts/contex...justmissed
Reply

Logout Mark Read Team Forum Stats Members Help
How to add a menu item to the EPG context menu0