Custom Keymap

  • Hey, I hope im posting in correct forum. I have googled and cant find anyone with this problem.

    I have a file "/storage/hyperion/set1.sh" with full executable rights. Script is fine. I can run it through shell.

    In remote.xml (File works ive tested other actions and they trigger)

    Code
    <keymap>
        <global>
            <remote>
                <red>RunScript("/storage/hyperion/set1.sh")</red>
            </remote>
        </global>
    </keymap>

    But RunScript does not execute.

    Kodi debug log:


    Im running:
    RPI3, LibreElec 7.90.003

  • I had this script and everything working in OpenElec, but moved to libre and doesnt work. So something is different with either libreelec or krypton. I guess krypton is the most likely one... But what... have spent half a day with this before i put my faith here ;)

    Edited once, last by AddeBC (July 26, 2016 at 4:36 PM).

    • Official Post

    as far as I know RunScript only works with python scripts.

    Quote
    Code
    RunScript(script[,args]*)


    Runs the python script. You must specify the full path to the script. One way to specify the full path is through the special protocol. If the script is an add-on, you can also execute it using its add-on id. As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv


    List of built-in functions - Official Kodi Wiki

  • Doh.
    I knew this!
    I have scripts in /storage/.config/scripts, and run them by running a python script from kodi to point to them.
    So I have, for eg...

    Code
    <home>
         <remote>
           <six>RunScript(script.rsynctest)</six>       
         </remote>
    </home>


    in remote.xml.
    That points to a simple python script...
    Addon.xml:


    default.py:

    Python
    #!/usr/bin/python
    
    
    import os
    
    
    os.system('sh /storage/.config/scripts/rsynctest.sh post')
    
    
    exit(0)


    Please don't laugh too loudly at my code (any suggestions welcome though) - it's all been trial and error for me. I have a few little scripts I use, all run the same way. It's a while since I last looked at them, though, which goes some way to explaining why I didn't see the problem.

    Edited once, last by trogggy (July 26, 2016 at 7:29 PM).

    • Official Post

    You don't need to setup the python script as an addon, you can just run it via the full path using single quotes

    to test you can always use kodi-send

    Code
    kodi-send --action="RunScript('/storage/path/to/pythonscript.py')"

  • You don't need to setup the python script as an addon, you can just run it via the full path using single quotes

    to test you can always use kodi-send

    Code
    kodi-send --action="RunScript('/storage/path/to/pythonscript.py')"

    Every day's a school day!
    Thanks, I can simplify things in my setup knowing that.
    So just to clarify (for me and the OP)...
    RunScript can start a python script anywhere, but it can't start a shell script...?

  • There's also System.Exec, using that to run a shell script without arguments seems to work fine but it seems it still causes the AudioEngine Error in kodi.log (tested with LE 7.0.2, not sure about alpha versions / krypton).