Kodi Community Forum

Full Version: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
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
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:
[email protected]:~$ ls -l /home/xbmc/callback
total 0
-rw-rw-r-- 1 xbmc xbmc 0 Jul 14 22:51 screensaver_off
[email protected]:~$

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?
Applescripts won't get executed.
Bash scripts are working.
(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!
Could you also add a XBMC Stops action, please?
(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,
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.
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
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
(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
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...
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?
(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
Thanks.

It could be usefull if I can 'attach' my script to your script programmatically, without user interaction...
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
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23