2003-12-03, 20:20
cyan - thanks for the script
darkie- keep up the good work
now i am in no way a python guru, so i need some help. as i stated before i am trying to contact and control my replaytv from my xbox. now i found a script that is written in python, however it uses wxpython for the gui part. which we don't have on this version. basically if someone could shove me in the right direction as how to handle this i would be greatful.
the main section that i need from the link below is this one:
that sends a broadcast out, and any replaytv will reply. just a shove, and if i get a rtfm comment it is ok. thanks in advance for whatever help you maybe.
http://www.flyingbuttmonkeys.com/replay/...vclient.py
^ is what i am basing this off of at the moment, i have a feeling that i just need to start from scratch but i am not sure.
thanks,
cp
darkie- keep up the good work
now i am in no way a python guru, so i need some help. as i stated before i am trying to contact and control my replaytv from my xbox. now i found a script that is written in python, however it uses wxpython for the gui part. which we don't have on this version. basically if someone could shove me in the right direction as how to handle this i would be greatful.
the main section that i need from the link below is this one:
Quote:##############################################################################
# upnp ( looks for replay units, sends events to gui )
# fixme: move manipulation of replay_device_list to gui thread
##############################################################################
class replay_upnp(thread):
def (self):
thread.(self)
self.socket = socket.socket(socket.af_inet, socket.sock_dgram)
self.socket.setblocking(0)
self.running = 1
self.start()
def send_search(self):
self.socket.sendto("m-search * http/1.1\r\nhost: 239.255.255.250:1900\r\nman: \"ssdp:discover\"\r\nst: urn:replaytv-com:device:replaydevice:1\r\nmx: 3\r\n\r\n",
0,('239.255.255.250', 1900))
def run(self):
ticks = 0
while(self.running):
if ticks % 60 == 0:
self.send_search()
ticks = ticks + 1
ready_to_read, ready_to_write, in_error = select.select([self.socket],[],[], 1)
if self.socket in ready_to_read:
data, addr = self.socket.recvfrom(512)
p = data.find('location: ')
loc = ''
if (p):
loc = data[p+10:]
p = loc.find('\n')
if (p):
loc = loc[:p]
loc = loc.strip()
device_info=''
fn=''
sn=''
if (loc):
try:
conn = httplib.httpconnection('%s:80' % addr[0])
conn.request("get", loc)
res = conn.getresponse()
device_info = res.read()
p = device_info.find('<?')
device_info = device_info[p:]
try:
dom = xml.dom.minidom.parsestring(device_info)
fn = dom.getelementsbytagname("friendlyname")[0]
sn = dom.getelementsbytagname("serialnumber")[0]
fn = gettext(fn.childnodes)
sn = gettext(sn.childnodes)
except:
pass
except:
device_info=''
try:
d = replay_device_list[addr[0]]
if fn == 'none' or fn == '':
fn = "(%s)" % addr[0]
try:
#app.frame.panela.setitemtext(d['id'], fn)
wxpostevent(app.frame,resultevent( ('setreplydevicename',d['id'],fn) ))
except:
pass
replay_device_list[addr[0]]={
'id': d['id'],
'loc': loc,
'device_info': device_info,
'friendlyname': fn,
'serialnumber': sn}
log(device_info)
except:
id = 0
try:
id = replay_device_list['_count']
except:
id = 0
replay_device_list['_count'] = id+1
replay_device_list[addr[0]]={
'id': id,
'loc':loc,
'device_info': device_info,
'friendlyname':fn,
'serialnumber': sn}
replay_device_list['_id%s'%id] = addr[0]
if fn == 'none' or fn == '':
fn = "(%s)" % addr[0]
else:
replay_device_list[fn]=addr[0]
#app.frame.panela.insertstringitem(id, fn)
wxpostevent(app.frame,resultevent( ('addreplydevice',id,fn) ))
that sends a broadcast out, and any replaytv will reply. just a shove, and if i get a rtfm comment it is ok. thanks in advance for whatever help you maybe.
http://www.flyingbuttmonkeys.com/replay/...vclient.py
^ is what i am basing this off of at the moment, i have a feeling that i just need to start from scratch but i am not sure.
thanks,
cp