[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
#64
(2013-12-16, 12:59)crax Wrote: This sounds like the add-on I am looking for.

I'm running XBMC on a Raspberry PI (in Raspbmc). I'm also using the same PI as Squeezelite player.
Unfortunately, with both programs running, I can not play DTS movies over HDMI, as the Squeezelite seems to be blocking the audio somehow.

If I stop the Squeezelite service there is no problem.

So now I'm hoping that your add-on can help me to stop Squeezelite when video starts and then start the Squeezelite again after the video stops?


Sure you can do it. I use it myself for something really similar in the same raspberry! Here is the script that I have to start hyperion when a video is played.

Code:
#!/usr/bin/env python

import os
import sys

# Check if not music
if not 'music' in sys.argv[1]:
  os.system('initctl start hyperion')

You should change the code inside os.system to suit your needs, save this command in any folder and configure the addon to execute the command when playback starts (and do something similar for when the playback is stopped).

Hope it helps.

(2013-12-16, 16:04)sIRwa2 Wrote:
Quote:14:48:45 T:2903493440 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.MemoryError'>
Error Contents:
Traceback (most recent call last):
File "/home/xbmc/.xbmc/addons/service.xbmc.callbacks-0.2/default.py", line 115, in onScreensaverDeactivated
subprocess.Popen([script_screensaver_stops])
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1244, in _execute_child
data = _eintr_retry_call(os.read, errpipe_read, 1048576)
File "/usr/lib/python2.7/subprocess.py", line 478, in _eintr_retry_call
return func(*args)
MemoryError
-->End of Python script error report<--
Im getting this in some XBMC Crashlogs. is this something to ignore?

Does your script work? I mean, it gets executed and do what you intented? My initial guess is that maybe the scripts fails for some reason and that crashes the addon Sad

Could you please let me know the OS you run xbmc and if you can execute the script outside XBMC with no problems?

Regards!
Reply


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 pilluli - 2013-12-19, 17:11
[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