[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
(2014-07-18, 08:52)prime0n Wrote: Hi KenV99,

is it possible to send simply http telegrams as notifications without script?
In case of "action" (player start/stop/pause-resume) send ip:port:"message". For "message" a simply number will be enough (1 = system start; 2.* = player start *media; 3 = stop; 4 = pause; 5 = resume...)
My problem is to get the actual status of xbmc without json request (because idle time).

Or - is there any documentation for your script to build my requested features?

Thanks in advanced!


EDIT:

Ok, i will try with python script. At the moment my server is down, so i can't try if it works or not.

my test script look like this:

Code:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.settimeout(2.0)
sock.connect(("192.168.70.249", 3654))
sock.settimeout(1.0)
msg = ''
sock.sendall(msg)

Is this ok for a simply message?

I agree with the conclusion you have arrived at - the http messaging that I implemented from within the script has some limitations. It doesn't use a raw socket to send messages. It requires a message formatted the same way you might put in a browser ("http://192.168.70.249:3654/mypageaddr?msg=1") and it isn't set up to pass parameters like 'media'. So you do need to implement that as your own script, as you have done. You'll need to pull in the arguments as a list with arglist = sys.argv if you want to pass 'media' to when the player starts...
Exactly how you setup the socket is obviously dependent on what the 'server' is expecting, so I won't be of much help there.
Good luck!
Reply


Messages In This Thread
Great! - by gnorf - 2013-02-27, 22:50
[RELEASE] Pilulli Revisited - by KenV99 - 2014-06-28, 18:18
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - by KenV99 - 2014-07-18, 14:59
Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4