Loading keymaps via Python
#1
I am helping to develop the TVCatchup EPG addin that streams UK television to XBMC.

We want to add custom controls when a stream is playing in full screen, for say changing channel up or down, jumping to channels, showing program information etc;

Code:
<keymap>
  <FullscreenVideo>
    <keyboard>
      <pageup>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, Up)</pageup>
      <pagedown>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, Down)</pagedown>      
      <zero>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 0)</zero>
      <one>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 1)</one>
      <two>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 2)</two>
      <three>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 3)</three>
      <four>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 4)</four>
      <five>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 5)</five>
      <six>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 6)</six>
      <seven>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 7)</seven>
      <eight>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 8)</eight>
      <nine>XBMC.RunScript(special://profile/addon_data/script.tvcatchup/change.py, 9)</nine>
    </keyboard>
  </FullscreenVideo>
</keymap>

We currently acheive this using the custom keymap file shown above in the userdata/keymaps folder. When the addin is run it first checks if the file exists and if not copies the file from the addin folder to the keymap folder and then prompt the user to restart XBMC (obviously this only needs to be done the once).

There are a couple of issue with this, firstly having to restart XBMC the first time isn't ideal, and secondly and more importantly the keymapping we add will not be restricted to our addin but instead will be used when ever fullscreen video is being played (which we would rather not be the case).

So what would be great would be a way (I don't care how hacky) to get XBMC to rescan for new or removed keymaps within the addin.

This way when the addin is first started it could copy the keymap file across to the userdata/keymaps folder, and then force a rescan of the keymaps. When our addin is exited we could then delete the file and force another rescan.

Any one got any ideas, or would this require a new feature to be added to XBMC itself (a new builtin function perhaps)?
Reply
#2
Well after more than a week of searching for a solution I finally stumbled upon what appears to be an undocumented feature:

Code:
xbmc.executebuiltin('Action(reloadkeymaps)')

Obvious when you know how!!
Reply
#3
It more hidden than undocumented Wink
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply

Logout Mark Read Team Forum Stats Members Help
Loading keymaps via Python0