Kodi Community Forum
v14 Map Key ID to Run - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166)
+---- Thread: v14 Map Key ID to Run (/showthread.php?tid=230782)



Map Key ID to Run - Abolfazl - 2015-06-29

I used the Keymap Editor addon to find out exactly what Key ID my delete button is on my keyboard. It is 61575. I am trying to map that key id to run a certain function. I found the gen.xml file in my /userdata/keymaps folder so I thought I would just add the following function

<key id="61575">RunScript("/home/osmc/.kodi/userdata/switch.py")</key>

Unfortunately this is not working. Am I correct in adding it to the gen.xml file? Is it supposed to go somewhere else?

To debug, I ran `python /home/osmc/.kodi/userdata/switch.py` and the function worked as expected. Is RunScript() deprecated?

Thanks in advance for the help!


RE: Map Key ID to Run - dandnsmith - 2015-06-29

I don't know about the RunScript,
but the location for the key addon is in /home/osmc/.kodi/userdata/keyboards/ in a file which should probably be called keyboard.xml or remote.xml.
You can find about this stuff in the kodi wiki.


RE: Map Key ID to Run - Abolfazl - 2015-06-29

So I turned on debugging and pushed the delete button and it turns out the action is being invoked. But for some reason I do not have the desired output. Is there a way to have my python script output to the debugging file so I can add some print statements or something?

Here is a snippet of my log: http://pastebin.com/VcFGL17M


RE: Map Key ID to Run - asavah - 2015-06-29

(2015-06-29, 16:55)Abolfazl Wrote: Is there a way to have my python script output to the debugging file so I can add some print statements or something?

http://romanvm.github.io/xbmcstubs/docs/xbmc-module.html#log


RE: Map Key ID to Run - Abolfazl - 2015-06-29

(2015-06-29, 17:33)asavah Wrote:
(2015-06-29, 16:55)Abolfazl Wrote: Is there a way to have my python script output to the debugging file so I can add some print statements or something?

http://romanvm.github.io/xbmcstubs/docs/xbmc-module.html#log

I did 'import xbmc' at the top and it said xbmc was not found. I thought xbmc can only be included from addons.