[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
pilluli Offline
Fan
Posts: 340
Joined: Jul 2006
Reputation: 1
Post: #46
matbor,

Make sure of two things:

1. That you can execute the scripts from the command line. So something like "./power.sh" does execute the script.

2. That you write the *entire* path into the script. So if the file "power.sh" is in the folder "/home/user/scripts/" then you write this to the addon:

"/home/user/scripts/power.sh".

It should work like this! Regardsm
find quote
sIRwa2 Offline
Member
Posts: 69
Joined: Oct 2008
Reputation: 0
Post: #47
oke, first error solved, driver issue.

Now, i have two .sh scripts, the first create the home/xbmc/callback/screensaver_off file,the second is called rem.sh and al it does is:

Code:
GNU nano 2.2.6                              File: rem.sh

#/bin/sh
rm /home/xbmc/callback/screensaver_off

when i ls /home/xbmc/callback/ i get this:
Code:
xbmc@mediacenter:~$ ls -l /home/xbmc/callback
total 0
-rw-rw-r-- 1 xbmc xbmc 0 Jul 14 22:51 screensaver_off
xbmc@mediacenter:~$

and when i run ./rem.sh the file is removed, but when i put it to callback addon, to the screensaver stops. It dont removeds it!

Yes, im using full paths. and execute on rem.sh is everyone. what else might be off?
(This post was last modified: 2013-07-14 23:16 by sIRwa2.)
find quote
bigbadrabbit Offline
Senior Member
Posts: 160
Joined: Sep 2008
Reputation: 0
Location: Austria
Post: #48
Applescripts won't get executed.
Bash scripts are working.

XBMC Gotham
OS X 10.9.3
Mac mini (late 2012) | i5 | 8GB RAM | SSD
find quote
bigbadrabbit Offline
Senior Member
Posts: 160
Joined: Sep 2008
Reputation: 0
Location: Austria
Post: #49
(2013-07-18 13:48)bigbadrabbit Wrote:  Applescripts won't get executed.
Bash scripts are working.

Nevermind. Found a way to execute the Applescript from inside a bash script. Now it's working.
Although it would be nice to have native Applescript support sometime.

Thanks for this great add-on!

XBMC Gotham
OS X 10.9.3
Mac mini (late 2012) | i5 | 8GB RAM | SSD
find quote
bigbadrabbit Offline
Senior Member
Posts: 160
Joined: Sep 2008
Reputation: 0
Location: Austria
Post: #50
Could you also add a XBMC Stops action, please?

XBMC Gotham
OS X 10.9.3
Mac mini (late 2012) | i5 | 8GB RAM | SSD
find quote
pilluli Offline
Fan
Posts: 340
Joined: Jul 2006
Reputation: 1
Post: #51
(2013-07-18 15:55)bigbadrabbit Wrote:  Nevermind. Found a way to execute the Applescript from inside a bash script. Now it's working.
Although it would be nice to have native Applescript support sometime.
Thanks for this great add-on!

Great you found a way! I only test the addon on linux (raspberry)...

(2013-07-18 21:04)bigbadrabbit Wrote:  Could you also add a XBMC Stops action, please?

Unfortunately I cannot find a reliable way to create that action. It does exist in the XBMC API but what happens is that sometimes XBMC quits *before* the script is executed...

Regards,
find quote
sIRwa2 Offline
Member
Posts: 69
Joined: Oct 2008
Reputation: 0
Post: #52
pilluli, can you test something for me? i can not seem to remove/delete the screensaver_off file, although all scripts and permissions are double checked! try ed python script, and bash, and bash triggering the python.. nothing. Can you do it on the rasp? my scripts are working in terminal, paths are full and double checked too.
find quote
sIRwa2 Offline
Member
Posts: 69
Joined: Oct 2008
Reputation: 0
Post: #53
i got the feeling thats a no...

Anyone else can help? that would be greatly appreciated, im really curious to find out if it is my noobiness or that there are other forces at work here..

kinda stuck here Sad
find quote
hansipi Offline
Junior Member
Posts: 7
Joined: May 2013
Reputation: 0
Post: #54
Great script!! Pillulli, works good for me. One request or how to question i do have. Hope someone can help.
The player actions work for both video and audio. I would like to know how i can use it just for video.

Ahhh found it myself..... type=music
(This post was last modified: 2013-10-23 15:18 by hansipi.)
find quote
pilluli Offline
Fan
Posts: 340
Joined: Jul 2006
Reputation: 1
Post: #55
(2013-10-23 13:57)hansipi Wrote:  Great script!! Pillulli, works good for me. One request or how to question i do have. Hope someone can help.
The player actions work for both video and audio. I would like to know how i can use it just for video.

Ahhh found it myself..... type=music

Yes, I was too late to answer... Smile

I use something like this in my scripts (python) to execute only for videos (not music):

Code:
#!/usr/bin/env python

if not 'music' in sys.argv[1]:
    # Do something
find quote
aquatroll Offline
Junior Member
Posts: 1
Joined: Nov 2013
Reputation: 0
Post: #56
Thanks for the work!

I've just made my raspbmc turn off my tv when it's idle (linking it to my screensaver).

If anyone is interested on how...

Linked "Screensaver starts" with this script:
Code:
#!/bin/sh

echo "standby 0" | cec-client -s -d 1 >> /dev/null

And "Screensaver stops" with this other script:
Code:
#!/bin/sh

echo "on 0" | cec-client -s -d 1 >> /dev/null

You do need a CEC compatible TV but I like my tv to turn off when I fall asleep or go out and turn it back on with the xbmc remote...
find quote
realtebo Offline
Senior Member
Posts: 164
Joined: Apr 2013
Reputation: 0
Post: #57
This is really a great idea, I found it only now.

I'd like to use your addon to intercept a play on a music file and then show a specific window, but mp3 playing must not be stopped-
Is it possible?
How?
find quote
pilluli Offline
Fan
Posts: 340
Joined: Jul 2006
Reputation: 1
Post: #58
(2013-12-14 13:16)realtebo Wrote:  This is really a great idea, I found it only now.

I'd like to use your addon to intercept a play on a music file and then show a specific window, but mp3 playing must not be stopped-
Is it possible?
How?

Right now the addon will execute an script (any script you set up in the preferences) whenever a file starts playing (file being a video or a music file). The script can now if it is a video or a music file as the script is executed with an argument saying "video" or "music". You can then do whatever you want in the script, like showing a specific window!!

Hope it helps
find quote
realtebo Offline
Senior Member
Posts: 164
Joined: Apr 2013
Reputation: 0
Post: #59
Thanks.

It could be usefull if I can 'attach' my script to your script programmatically, without user interaction...
find quote
pilluli Offline
Fan
Posts: 340
Joined: Jul 2006
Reputation: 1
Post: #60
I guess you could always create the file "settings.xml" in the addon_data folder yourself with the script name and callback. That way there is no need to configure the add on manually.

Regards
find quote
Post Reply