[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)

  Thread Rating:
  • 3 Votes - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Ferdi-T Offline
Senior Member
Posts: 194
Joined: Jul 2011
Reputation: 1
Post: #151
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!
find quote
schumi2004 Offline
Posting Freak
Posts: 1,426
Joined: Aug 2011
Reputation: 14
Post: #152
Pretty neat addon.
I don't think it's possible to let this addon change other addon settings can it?
find quote
Ferdi-T Offline
Senior Member
Posts: 194
Joined: Jul 2011
Reputation: 1
Post: #153
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.
(This post was last modified: 2014-10-04 20:54 by Ferdi-T.)
find quote
tehKNi Offline
Junior Member
Posts: 5
Joined: Sep 2014
Reputation: 0
Post: #154
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' 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
(This post was last modified: 2014-10-04 18:52 by tehKNi.)
find quote
KenV99 Offline
Senior Member
Posts: 230
Joined: Nov 2013
Reputation: 7
Post: #155
(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' 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?
find quote
tehKNi Offline
Junior Member
Posts: 5
Joined: Sep 2014
Reputation: 0
Post: #156
(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 Tongue)

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 ;-)
(This post was last modified: 2014-10-04 19:45 by tehKNi.)
find quote
KenV99 Offline
Senior Member
Posts: 230
Joined: Nov 2013
Reputation: 7
Post: #157
(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 Tongue)

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.
find quote
tehKNi Offline
Junior Member
Posts: 5
Joined: Sep 2014
Reputation: 0
Post: #158
that last workaround works well and is good enough for me Smile
thanks!
find quote
sutkade Offline
Junior Member
Posts: 1
Joined: Oct 2014
Reputation: 0
Post: #159
Forgive my ignorance, but is the list of possible arguments passed to the called scripts available somewhere?
find quote
KenV99 Offline
Senior Member
Posts: 230
Joined: Nov 2013
Reputation: 7
Post: #160
(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
find quote
Post Reply