2013-10-15, 03:39
Hi All,
I have just started learning Python so I can create some scripts for a few devices around the house that can be triggered from different things in XBMC. Now keep in mind I am VERY new to programming, but I'm usually pretty quick to pick these kind of things up.
My first attempt is to get XBMC to send a HTTP command ("http://192.168.0.5:8080/redeye/rooms/0/activities/launch?activityId=200") to my Think Flood Redeye unit to run an activity. This one turns on the TV, receiver and selects the correct volume and surround setting for a movie via IR signals.
I have found a script on the net that I have modified, but when I start a video, it flashes up a CMD box and disappears (too quick to read it) without triggering the activity. Can someone point out where I have gone wrong with this script? I'm guessing its something to do with "wget --spider"??
I would like to start building on this one for other tasks, but cant seem to find where I have gone wrong (I've already started some of the Python Tutorials but that's going to take some time).
System details are:
Win 7 64bit
XBMC Frodo 12.2
Script:
----------------------------------------------------------------------------------------
import xbmc,xbmcgui
import subprocess,os
class MyPlayer(xbmc.Player) :
def __init__ (self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
if xbmc.Player().isPlayingVideo():
os.system("wget --spider 'http://192.168.0.5:8080/redeye/rooms/0/activities/launch?activityId=200'")
player=MyPlayer()
VIDEO = 0
while(1):
if xbmc.Player().isPlaying():
if xbmc.Player().isPlayingVideo():
VIDEO = 1
else:
VIDEO = 0
xbmc.sleep(1000)
----------------------------------------------------------------------------------------
I have just started learning Python so I can create some scripts for a few devices around the house that can be triggered from different things in XBMC. Now keep in mind I am VERY new to programming, but I'm usually pretty quick to pick these kind of things up.
My first attempt is to get XBMC to send a HTTP command ("http://192.168.0.5:8080/redeye/rooms/0/activities/launch?activityId=200") to my Think Flood Redeye unit to run an activity. This one turns on the TV, receiver and selects the correct volume and surround setting for a movie via IR signals.
I have found a script on the net that I have modified, but when I start a video, it flashes up a CMD box and disappears (too quick to read it) without triggering the activity. Can someone point out where I have gone wrong with this script? I'm guessing its something to do with "wget --spider"??
I would like to start building on this one for other tasks, but cant seem to find where I have gone wrong (I've already started some of the Python Tutorials but that's going to take some time).
System details are:
Win 7 64bit
XBMC Frodo 12.2
Script:
----------------------------------------------------------------------------------------
import xbmc,xbmcgui
import subprocess,os
class MyPlayer(xbmc.Player) :
def __init__ (self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
if xbmc.Player().isPlayingVideo():
os.system("wget --spider 'http://192.168.0.5:8080/redeye/rooms/0/activities/launch?activityId=200'")
player=MyPlayer()
VIDEO = 0
while(1):
if xbmc.Player().isPlaying():
if xbmc.Player().isPlayingVideo():
VIDEO = 1
else:
VIDEO = 0
xbmc.sleep(1000)
----------------------------------------------------------------------------------------