[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
(2014-03-10, 10:28)flarc Wrote: Hello, thanks for your helps.

1) Ok, so currently, my settings.xml is like this:
<setting id="player_pauses" value="C:\sarah\plugins\fred\bin\huelight_high.bat" />

And the "huelight_high.bat" is like that:
@echo off
cd C:\sarah\plugins\fred\bin
curl -X PUT -d "{\"on\":true, \"bri\":228}" >> NUL

This works, but i see a brief console window appear.

2) I tried also this (xml manually edited because .vbs is not displayed in xbmc add-on configuration screen):

<setting id="player_pauses" value="C:\sarah\plugins\fred\bin\huelight_high.vbs" />

Set WshShell = WScript.CreateObject("WScript.Shell")
cmd = "C:\sarah\plugins\fred\bin\huelight_high.bat"
Return = WshShell.Run(cmd, 0, True)
set WshShell = Nothing

The huelight_high.bat is unchanged.

If i run manually the vbs, it works without console appearing.
But within XBMC, the command is not performed (which i can see only due to no change of light)

Does not work either with:
<setting id="player_pauses" value="wscript C:\sarah\plugins\fred\bin\huelight_high.vbs" />

3) I also tried compiling the .bat into .exe, and updating accordingly the settings.xml, but does not work either.
<setting id="player_pauses" value="C:\sarah\plugins\fred\bin\huelight_high.exe" />

4) I did not try yet to put directly the long curl command into the settings.xml (i need to see how to manage the quotes within the command).

5) Last thing i would try (but i do not know yet how to do it) is calling directly a python script (that would be interpreted by xbmc's own python lib) to change hue lights.

If you have an idea to make option#1 or #2 work, it would be helpful, because i would prefer those ways of doing it. But if option#5 would work, i will take it.

The way the plugin is currently written, it does not parse the string 'wscript C:\..\huelight_high.vbs' into two separate arguments to be passed to subprocess.call().
And that python call needs the 'wscript' argument to be passed because it is being called without the shell=true option.
If I have time I might fork the master branch and come up with a way to parameterize the strings for interpretation. Something along the lines of enclosing each individual parameter in curly brackets and then have the script parse them into a tuple that can be passed in subprocess.call().

Maybe pilluli can weigh in at some point...
Thread Rating:
  • 4 Vote(s) - 4.5 Average

Messages In This Thread
Great! - by gnorf - 2013-02-27, 22:50
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - by KenV99 - 2014-03-10, 18:00
[RELEASE] Pilulli Revisited - by KenV99 - 2014-06-28, 18:18

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4.54
This forum uses Lukasz Tkacz MyBB addons.