Kodi Community Forum

Full Version: Need advice on how to execute a custom shutdown script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am currently using CoreELEC in a dual boot with Android. I want to map a keyboard key to run a custom shutdown script which reboots the system from Android.
Now I know the commands that do that (Rebootfromnand && Reboot) but I am not sure how to bind it to a keyboard press (such as A FUNCTION KEY) 

I am using my system with a FLIRC device, so its easy for me to map a key to one of the function keys, I just dont know how to tell the box to execute that shutdown script once it receives the key press.

Can anybody help me with this? 

Thanks in advance!
You need to create a keymap (wiki) with something like this in it.

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keymap>
    <global>
        <keyboard>
            <f11>RunScript(full/path/to/script/with/name.py)</f11>
        </keyboard>
    </global>
</keymap>

You will have to write a small python script to import os and call those shell commands as I don't think Kodi can natively call the shell.
(2020-07-14, 14:17)black_eagle Wrote: [ -> ]You need to create a keymap (wiki) with something like this in it.

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keymap>
    <global>
        <keyboard>
            <f11>RunScript(full/path/to/script/with/name.py)</f11>
        </keyboard>
    </global>
</keymap>

You will have to write a small python script to import os and call those shell commands as I don't think Kodi can natively call the shell.

Cheers..

I got it to work. Thanks for your help!!