• 1
  • 9
  • 10
  • 11(current)
  • 12
  • 13
  • 23
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
Writing to a tekst-file was a totally brilliant solution. Works like a charm!

I initially still the same problems with the pause/resume, but solved it by repeating the same trick, only with a differently named txt.

Thanks a lot, you really helped me out & I learned a lot in the process!
Reply
Pretty neat addon.
I don't think it's possible to let this addon change other addon settings can it?
Reply
Hmm, something went wrong yesterday when XBMC crashed halfway through The Hobbit. Now playing a file doesn't generate a txt-file anymore, which means that stopping the video doesn't trigger anything at all. :-(

Any thoughts?

Edit: reinstalled XBMC, the whole system went haywire. Prolly corrupted the SD, too much overclocking of the Pi. Reinstalled scripts, stuff seems to be working fine now.
Reply
Hello,

Actually i can't trigger anything right now as well, but it's my first try :

18:11:06 T:2923959376 NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: /storage/.xbmc/addons/service.xbmc.callbacks2-allincluded
18:11:08 T:2923959376 NOTICE: $$$ [xbmc.callbacks2] - Executing command: u'/storage/hyperion/stop.sh' (wiki) for event: onPlaybackStarted
18:11:08 T:2923959376 NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: /bin/sh: /storage/hyperion/stop.sh: not found

can't understand that though, as i can launch it manually with no problem :

OpenELEC:~/hyperion # /bin/sh /storage/hyperion/stop.sh
killall: hyperiond: no process killed

Weird?
Smile
Reply
(2014-10-02, 15:18)schumi2004 Wrote: Pretty neat addon.
I don't think it's possible to let this addon change other addon settings can it?

I'm not quite sure what you mean... In general, since python scripts running from this addon are executed in the XBMC namespace, yes, you could using .setSetting: http://mirrors.xbmc.org/docs/python-docs...setSetting

(2014-10-04, 12:33)Ferdi-T Wrote: Hmm, something went wrong yesterday when XBMC crashed halfway through The Hobbit. Now playing a file doesn't generate a txt-file anymore, which means that stopping the video doesn't trigger anything at all. :-(

Any thoughts?

Post a log to xbmclogs.com and post back here.

(2014-10-04, 18:15)tehKNi Wrote: Hello,

Actually i can't trigger anything right now as well, but it's my first try :

18:11:06 T:2923959376 NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: /storage/.xbmc/addons/service.xbmc.callbacks2-allincluded
18:11:08 T:2923959376 NOTICE: $$$ [xbmc.callbacks2] - Executing command: u'/storage/hyperion/stop.sh' (wiki) for event: onPlaybackStarted
18:11:08 T:2923959376 NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: /bin/sh: /storage/hyperion/stop.sh: not found

can't understand that though, as i can launch it manually with no problem :

OpenELEC:~/hyperion # /bin/sh /storage/hyperion/stop.sh
killall: hyperiond: no process killed

Weird?
Smile
Are you checking off 'requires shell' in the options and only including '/storage/hyperion/stop.sh' as script that you are executing?
Reply
(2014-10-04, 19:30)KenV99 Wrote: Are you checking off 'requires shell' in the options and only including '/storage/hyperion/stop.sh' as script that you are executing?

Nop, i checked.
When i didn't check i had another error (that was longer :p)

Code:
19:43:08 T:2891072592  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: /storage/.xbmc/addons/service.xbmc.callbacks2-allincluded
19:43:10 T:2891072592  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [[u'/storage/hyperion/stop.sh']] for event: onPlaybackStarted
19:43:10 T:2891072592  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: <attribute 'message' of 'exceptions.BaseException' objects>
                                            Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/service.xbmc.callbacks2-allincluded/default.py", line 472, in run
                                                result = subprocess.check_output(margs, shell=self.needs_shell, stderr=subprocess.STDOUT)
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 537, in check_output
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 679, in __init__
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
                                            OSError: [Errno 2] No such file or directory

But that may be interesting anyway, yeah ;-)
Reply
(2014-10-04, 19:35)tehKNi Wrote:
(2014-10-04, 19:30)KenV99 Wrote: Are you checking off 'requires shell' in the options and only including '/storage/hyperion/stop.sh' as script that you are executing?

Nop, i checked.
When i didn't check i had another error (that was longer :p)

Code:
19:43:08 T:2891072592  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: /storage/.xbmc/addons/service.xbmc.callbacks2-allincluded
19:43:10 T:2891072592  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [[u'/storage/hyperion/stop.sh']] for event: onPlaybackStarted
19:43:10 T:2891072592  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: <attribute 'message' of 'exceptions.BaseException' objects>
                                            Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/service.xbmc.callbacks2-allincluded/default.py", line 472, in run
                                                result = subprocess.check_output(margs, shell=self.needs_shell, stderr=subprocess.STDOUT)
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 537, in check_output
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 679, in __init__
                                              File "/home/stephan/projects/openelec-4.2/build.OpenELEC-RPi.arm-4.2.1/Python-2.7.3/.install_pkg/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
                                            OSError: [Errno 2] No such file or directory

But that may be interesting anyway, yeah ;-)
In both cases it cannot find the file. I don't have a pure linux system to test on, but it behaves properly for others and works for me on Android.
You might try moving your script to the add on directory and see if it will run from there.
If that doesn't work, turn off 'needs shell' and use bash as the executable and the fully specified path/filename of your script as the user argument and see if that works. I would turn off the 'Event_ID' parameter from the Settings/Parameters page if doing it that way.
Reply
that last workaround works well and is good enough for me Smile
thanks!
Reply
Forgive my ignorance, but is the list of possible arguments passed to the called scripts available somewhere?
Reply
(2014-10-10, 03:05)sutkade Wrote: Forgive my ignorance, but is the list of possible arguments passed to the called scripts available somewhere?

On the wiki on the github page.
https://github.com/KenV99/service.xbmc.callbacks2/wiki
Reply
Recently switched from Raspbmc to OPENelec for stability-reasons. However, I haven't been able to get the python-scripts to work there.

This is the script:

Code:
#!/usr/bin/env python
import sys
if not 'music' in sys.argv[1]:
    import subprocess
    subprocess.call('~/milight/blauw.sh')
    open('~/milight/lightsoff.txt', 'a').close()
0

Error:
[code]
Traceback (most recent call last):
File "start.py", line 3, in <module>
if not 'music' in sys.argv[1]:
IndexError: list index out of range

Is sys.argv set up differently with Elec?
Reply
(2014-11-21, 20:05)Ferdi-T Wrote: Recently switched from Raspbmc to OPENelec for stability-reasons. However, I haven't been able to get the python-scripts to work there.

...

Is sys.argv set up differently with Elec?

It shouldn't be any different AFAIK...
You may want to look at the settings pages and make sure that the Parameters page is set up the same as you had it.
Otherwise, if you are calling this as a python script (as opposed to a generic script) to troubleshoot you may want to try:

Code:
#!/usr/bin/env python
import sys
import xbmc
xbmc.log("******** sys.arg: {0}".format(str(sys.arg)))
if not 'music' in sys.argv[1]:
    import subprocess
    subprocess.call('~/milight/blauw.sh')
    open('~/milight/lightsoff.txt', 'a').close()
0

And look in the logs to see what the args are that are being sent.

Clicking 'Test Command' and looking at the output may help as well...
Reply
Is anyone using this with Helix RC on OS 10.10. Just want to check before I troubleshoot further. Thanks.
Macmini Server 2011 i7 Quad Core, OS 10.8.2, Amp Onkyo TX-SR308 USB WD drives 3x2TB TV Samsung Plasma 720p EyeTV Integration
There are only 10 kinds of people in this world, those who understand binary, and those who don't.



Reply
Ok got it working with Helix using Kens fork. Initially struggled to call the applescript using Bash. I went instead calling the applescript from the testme python file using osascript command. The testme files remains in the addon diretory. Am now dimming/lighting the Lifx bulbs on media playback.
Macmini Server 2011 i7 Quad Core, OS 10.8.2, Amp Onkyo TX-SR308 USB WD drives 3x2TB TV Samsung Plasma 720p EyeTV Integration
There are only 10 kinds of people in this world, those who understand binary, and those who don't.



Reply
@KenV99 on linux your script works fine, but under windows when I try to open url's (trigger url's on an arduino wich controls lights) I get several errors

the errors is in default.py line 562, this part => u = urllib2.urlopen(self.cmd_str, timeout=20)

and then multiple errors then in the python part of kodi

the erorrs display in a window of your addon, can't copy the output

so basicly trigegring of url's under windows does not work,it works fine under linux, btw I'm using kodi helix rc3
Reply
  • 1
  • 9
  • 10
  • 11(current)
  • 12
  • 13
  • 23

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4