Solved Multiple actions for keymap?
#1
Keymap question...

Is it possible to have multiple actions when a key is hit?
- such as Dialog.Close(VideoOSD); ActivateWindow(TVGuide)

Alternatively, is it possible for a key to send a press to a button on the screen?
HDHomerun Quatro, RaspPi/TVHeadend, NUC/Win10/Kodi, Mousetuary skin, Mouse on couch!
Reply
#2
Yes. Just put all your actions in a .py script file and execute this script via a key-map definition.

E.g.:
In keymaps.xml

<key id="xxxxx">
runscript(special://masterprofile/addon_data/scripts/myactions.py)
</key>


In myactions.py:

     import xbmc

     xbmc.executebuiltin("Action(SubtitleDelayPlus)")
     xbmc.executebuiltin("Action(SubtitleDelayPlus)")
     xbmc.executebuiltin("Action(SubtitleDelayPlus)")
     xbmc.executebuiltin("Action(SubtitleDelayPlus)")
     xbmc.executebuiltin("Action(SubtitleDelayPlus)")


This script lets me delay my subtitles 1/2 a second (5 times 0.1 seconds)
Kodi 20.1 with Aeon Nox Silvo,
Nvidia shield Pro 9.1.1 with Android 11.
Reply
#3
Cool, thanks!
HDHomerun Quatro, RaspPi/TVHeadend, NUC/Win10/Kodi, Mousetuary skin, Mouse on couch!
Reply
#4
(2017-05-15, 10:31)cizzz Wrote: Yes. Just put all your actions in a .py script file and execute this script via a key-map definition.

E.g.:
In keymaps.xml

<key id="xxxxx">
runscript(special://masterprofile/addon_data/scripts/my actions.py)
</key>


In actions.py:

import xbmc

xbmc.executebuiltin("Action(SubtitleDelayPlus)")
xbmc.executebuiltin("Action(SubtitleDelayPlus)")
xbmc.executebuiltin("Action(SubtitleDelayPlus)")
xbmc.executebuiltin("Action(SubtitleDelayPlus)")
xbmc.executebuiltin("Action(SubtitleDelayPlus)")

This script lets me delay my subtitles 1/2 a second (5 times .1 seconds)
i have a remote
by default the arrow keys behave like normal but when i play a video file, i want to be able to use arrow down and up for next and previous file, i probobly need a condition for when arrow keys should work i default mode and then switch to next/previous when playing a video
Ryzen 1500X, 2x8GB 3000 DDR4, RX 560 4GB, 250GB EVO, Windows 10
Reply
#5
Late reply. :-)
Yes, you can install the Kodi keymap editor addon for that. This will allow you to remap your remote buttons as you wish depending on the Kodi section you are in.
Here is an example that I'm using when in video fullscreen.
E.g. When I press "0" on my remote, it activates the subtitle download window immediately when I'm playing a video.
 
Quote:
Code:
<keymap>
    <global>
        <keyboard>
            <key id="f5">xbmc.reloadskin()</key>
            <key id="f6">skin.togglesetting(debuggrid)</key>
            <key id="f7">skin.togglesetting(hidedebuginfo)</key>
            <key id="f8">notification(testing 123,hello world)</key>
            <key id="red">activatewindow(10040,"addons://user/all",return)</key>
            <key id="green">info</key>
            <key id="yellow">pageup</key>
            <key id="blue">pagedown</key>
            <key id="61668">activatewindow(settings)</key>
        </keyboard>
    </global>
    <music>
        <keyboard>
            <key id="61489">audiodelayminus</key>
            <key id="61491">audiodelayplus</key>
        </keyboard>
    </music>
    <videos>
        <keyboard>
            <key id="61628">contextmenu</key>
        </keyboard>
    </videos>
    <fullscreenvideo>
        <keyboard>
            <key id="61495">audiodelayminus</key>
            <key id="61497">audiodelayplus</key>
            <key id="61492">subtitledelayminus</key>
            <key id="61489">runscript(special://masterprofile/addon_data/scripts/subminus.py)</key>
            <key id="61627">runscript(special://masterprofile/addon_data/scripts/subminus.py)</key>
            <key id="61494">subtitledelayplus</key>
            <key id="61491">runscript(special://masterprofile/addon_data/scripts/subplus.py)</key>
            <key id="61626">runscript(special://masterprofile/addon_data/scripts/subplus.py)</key>
            <key id="61488">activatewindow(subtitlesearch)</key>
            <key id="61584">activatewindow(subtitlesearch)</key>
            <key id="61490">showsubtitles</key>
            <key id="61637">fastforward</key>
            <key id="61636">rewind</key>
            <key id="61496">audionextlanguage</key>
            <key id="61493">nextresolution</key>
            <key id="61493">info</key>
            <key id="61448">stop</key>
            <key id="61668">bigstepforward</key>
            <key id="61667">bigstepback</key>
        </keyboard>
    </fullscreenvideo>
</keymap>
Kodi 20.1 with Aeon Nox Silvo,
Nvidia shield Pro 9.1.1 with Android 11.
Reply
#6
I find this confusing , the keymap text you show above , the brackets say "keyboard" , I naturally assumed that they were keyboard buttons mapped to control kodi , but you say the subtitle menu appears when you press "0" on your remote ?
Also , how would I identify key"0" looking at those codes in your list please ?
Reply
#7
Correct. A remote control device is also considered a keyboard in Kodi.
Kodi 20.1 with Aeon Nox Silvo,
Nvidia shield Pro 9.1.1 with Android 11.
Reply

Logout Mark Read Team Forum Stats Members Help
Multiple actions for keymap?0