sending an http event on a specific window (live TV)
#1
I am trying to get my remote xbmc clients to send an http command to a web server when they access "live tv" this will in turn send an ir signal to wake up the sky box. I have tried various ways but haven't found a solution.

I have set up a similar thing using autoexec.py and a playeractions script for Movie player events, but can find the way to do this based on a specific addon/menu item.

in simple terms all I want is when you select live tv the following be sent:

urllib2.urlopen('http://192.168.1.141/ajax_sendevent.lhtml?event=study_live_tv&device=18')

thanks for any pointers.

Tyrherman
Reply
#2
moving to the dev forum, you might have more luck there
Reply
#3
there's a "WakeOnLan" builtin you could add an extra <onclick> to the skin file for the button that launches live tv if the skybox supported that.

if the IR is the only way, then an extra <onclick> that calls RunAddon(), where the addon is a simple python addon to do what you want.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#4
I dont need worry about the sky box as I am using girder to translate all events into whatever action I need, for example the lights and USBUIRT are all controlled by girder. I use the python script already detailed on http://www.jordanhackworth.com/home-auto...with-xbmc/ but this is about as much as I know about python.

if I want to add the http command to the <onclick> within the skin (aeon nox) which xml would I edit and could this simply send the http command?
Reply
#5
I'd use a service addon to check the current window, sleep a while, check again, etc. When it finds the right window, send the command
Reply
#6
can you put 2 actions <onclick> in the skin settings? i.e. when you select "live tv" 1st one activates_window, 2nd runs addon, then use an addon to send the http command?
Reply
#7
You could just run the add-on and have it call the activate window built-in, then send the command.

Also, make sure you backup your changes as they'll be over written when the skin updates
Reply
#8
ok think I got it, so set the skin to activate the addon and within the addon have it do both activate_liveTV and send the http command. Anyone point me to a simple addon I could modify as Python is completely new to me, but my editing is good! :-)
Reply
#9
If you're editing the skin you don't even need a full add-on, just a script. Xbmc.executeBuiltin() will let you call activate window. On my phone or I'd give you a snippet, but you should be able Google it from there.
Reply
#10
first things first, this thread was moved to python but in fairness I have little understanding of python, so when you say "just a script. Xbmc.executeBuiltin() will let you call activate window" you may as well have told me to run to the moon :-( second problem is I can't even find where in the skin to edit this!! - how embarrassing! I am using aeon nox and cannot see anywhere in the home.xml that is obvious.

have been googling pretty much all day in between watching the football and to say I am struggling is an understatement.

so this is my understanding of what you say I need to do:

if I could write a script (which consists of a folder in the addons with 2 files. addon.xml and default.py??) I could then call that script from the onclick livetv?

I apologise if I am a complete novice, I will also look at using a simple skin which may also help!
Reply
#11
So for your script, put this in a .py file:
Code:
import xbmc
import urllib2

urllib2.urlopen('http://192.168.1.141/ajax_sendevent.lhtml?event=study_live_tv&device=18')
xbmc.executebuiltin('ActivateWindow(mypvr)')

Then in your onClick:
Code:
<onclick>RunScript(C:\path\to\above\file.py)</onclick>

That's assuming that the mypvr window is what you mean by "live tv." Just in case, you can find the list of windows here: http://wiki.xbmc.org/index.php?title=Window_IDs
Reply
#12
that looks so simple! I am away till thursday but will be certain to test it then. Thanks!Big Grin
Reply
#13
update, couldn't wait so tested and it works perfectly!!

thanks for your help! just need to see if I can find the place to edit Aeon Nox or stick with one of the simpler skins,
Reply

Logout Mark Read Team Forum Stats Members Help
sending an http event on a specific window (live TV)0