Loading keymaps via Python

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
spoyser Offline
Posts: 1,298
Joined: Oct 2011
Reputation: 69
Post: #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;

      <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>

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)?
(This post was last modified: 2012-06-13 14:18 by spoyser.)
find quote
spoyser Offline
Posts: 1,298
Joined: Oct 2011
Reputation: 69
Post: #2
Well after more than a week of searching for a solution I finally stumbled upon what appears to be an undocumented feature:


Obvious when you know how!!
(This post was last modified: 2012-06-14 17:18 by spoyser.)
find quote
Martijn Offline
Team Kodi
Posts: 16,618
Joined: Jul 2011
Reputation: 296
Location: Dawn of time
Post: #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
find quote