Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

XBMC event based commands
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
XBMC event based commands
21st Oct, 2014, 11:40 PM
Post: #1
Calzor Suzay Offline
Registered
Posts: 27
Joined: Apr 2014
Reputation: 1
XBMC event based commands
Does XBMC on Xbian 1.0RC3 have any events based logic built in?

I want to on play or pause of a video/film be able to send a htpp:// json command to be able to control my lights.
Find all posts by this user
Quote this message in a reply
22nd Oct, 2014, 12:05 AM
Post: #2
menakite Offline
Management
******
Posts: 175
Joined: Apr 2014
Reputation: 27
RE: XBMC event based commands
XBMC supports add-ons written in Python. In this case you can have a look at https://github.com/xbianonpi/xbian-package-upstart-xbmc-bridge/tree/master/content/usr/local/share/xbmc/addons/script.service.xbian.upstart-bridge as a base.

We emit a number of Upstart events already though. I'd suggest you look at https://github.com/xbianonpi/xbian-package-upstart-xbmc-bridge/blob/master/content/etc/init/xbian-xbmc-player.conf
Find all posts by this user
Quote this message in a reply
22nd Oct, 2014, 01:20 AM
Post: #3
Calzor Suzay Offline
Registered
Posts: 27
Joined: Apr 2014
Reputation: 1
RE: XBMC event based commands
Very useful thanks I'll look into it Smile
Find all posts by this user
Quote this message in a reply
23rd Oct, 2014, 02:38 AM
Post: #4
Calzor Suzay Offline
Registered
Posts: 27
Joined: Apr 2014
Reputation: 1
RE: XBMC event based commands
Ok it can be done but I don't get what or how Sad

Upstart events look good enough for me but how do I make use of this?
Do I need to copy the gen.package.sh script somewhere, is it already running?

Do I just need to modify the xbian-xbmc-player.conf script to have the upstart action call a webpage (Json)?

Mine is currently:-
env TYPE=none

instance $TYPE

start on player ACTION=PLAY
stop on player ACTION=STOP

pre-start script
/usr/local/sbin/xbian-led FRONT trigger none
/usr/local/sbin/xbian-led FRONT brightness 0
end script

post-stop script
/usr/local/sbin/xbian-led FRONT trigger cpu0
end script
Find all posts by this user
Quote this message in a reply
23rd Oct, 2014, 04:15 AM
Post: #5
menakite Offline
Management
******
Posts: 175
Joined: Apr 2014
Reputation: 27
RE: XBMC event based commands
Copy xbian-xbmc-player.conf to, for example, xbmc-json-lights.conf (sudo cp xbian-xbmc-player.conf xbmcplayer-json-lights.conf).

Then delete everything between "pre-start script" and "end script", the same applies for "post-stop script"/"end script" (you'd need sudo to modify it: sudo nano xbmcplayer-json-lights.conf).

"pre-start script" is executed when the playback starts (or unpaused) and "post-stop script" when the playback ends.

The shell commands to control your lights (I can't really help on this, check your documentation) should be added between "pre-start/post-stop script" and "end script".

If you want to execute the same commands when the playback is paused you'd need to change the line:
stop on player ACTION=STOP
to:
stop on player ACTION=STOP or player ACTION=PAUSE
Find all posts by this user
Quote this message in a reply
23rd Oct, 2014, 10:19 PM
Post: #6
Calzor Suzay Offline
Registered
Posts: 27
Joined: Apr 2014
Reputation: 1
RE: XBMC event based commands
Woohoo got it working! Smile

Had to work out how to call a webpage for the json command but curl got me there.

Cheers Smile
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 10th May, 2025, 09:28 PM Powered By MyBB, © 2002-2025 MyBB Group.