2014-12-16, 23:38
Hi all
Just wondering if anyone knows how to run a custom python script from the remote.xml?
Seems to fail when the built in python interpreter tries to run it.
Does my script need to be placed somewhere inside appdata.roaming/xbmc?
Here is my current remote xml file.
------------------------------------------------------------------------------------------------------
<keymap>
<global>
<remote>
<red>UpdateLibrary(video)</red>
<green>XBMC.RunScript(C:\4_USB_Relay\relay_1.pyw)</green>
<yellow>ActivateWindow(Home)</yellow>
<blue>XBMC.RunScript(C:\4_USB_Relay\relay_4.pyw)</blue>
</remote>
</global>
</keymap>
-----------------------------------------------------------------------------------------------------
Here is the relay_1.pyw script
-----------------------------------------------------------------------------------------------------
import subprocess
get_state = "python drcontrol.py -d DAE001DQ -r 1 -c STATE"
turn_on = "python drcontrol.py -d DAE001DQ -r 1 -c ON"
turn_off = "python drcontrol.py -d DAE001DQ -r 1 -c OFF"
x = subprocess.check_output(get_state, shell=True)
x = x.rstrip('\n')
if 'ON' in x:
subprocess.call(turn_off, shell=True)
else:
subprocess.call(turn_on, shell=True)
-----------------------------------------------------------------------------------------------------
Also I have tried these scripts outside of xbmc and they run fine.
Not sure if .pyw is the issue in xbmc but I have tried both .pyw and .py.
Cheers, Damien
Just wondering if anyone knows how to run a custom python script from the remote.xml?
Seems to fail when the built in python interpreter tries to run it.
Does my script need to be placed somewhere inside appdata.roaming/xbmc?
Here is my current remote xml file.
------------------------------------------------------------------------------------------------------
<keymap>
<global>
<remote>
<red>UpdateLibrary(video)</red>
<green>XBMC.RunScript(C:\4_USB_Relay\relay_1.pyw)</green>
<yellow>ActivateWindow(Home)</yellow>
<blue>XBMC.RunScript(C:\4_USB_Relay\relay_4.pyw)</blue>
</remote>
</global>
</keymap>
-----------------------------------------------------------------------------------------------------
Here is the relay_1.pyw script
-----------------------------------------------------------------------------------------------------
import subprocess
get_state = "python drcontrol.py -d DAE001DQ -r 1 -c STATE"
turn_on = "python drcontrol.py -d DAE001DQ -r 1 -c ON"
turn_off = "python drcontrol.py -d DAE001DQ -r 1 -c OFF"
x = subprocess.check_output(get_state, shell=True)
x = x.rstrip('\n')
if 'ON' in x:
subprocess.call(turn_off, shell=True)
else:
subprocess.call(turn_on, shell=True)
-----------------------------------------------------------------------------------------------------
Also I have tried these scripts outside of xbmc and they run fine.
Not sure if .pyw is the issue in xbmc but I have tried both .pyw and .py.
Cheers, Damien