31 May 2011

Python Meo remote control

Just finished a script to remote control Meo box.
It's in python.


#!/usr/bin/python
2 import socket
3
4 HOST = '192.168.1.66' # The remote host
5 PORT = 8082 # The same port as used by the server
6 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
7 s.connect((HOST, PORT))
8 data = s.recv(1024)
9 print 'Received', repr(data)
10
11 #1,2,3,4,5,6,7,8,9,0,av,enter,v+,p+,v-,p-,ok,menu,back,screen,guia,video,i,switchscreen,gravacao,stop,play,pause,up,down,left,right,prev,rev,forw,next ,red,green,yellow,blue,mute,song,riscas,tv
12 meo_key = [
13 49,50,51,52,53,54,55,56,57,48,#0
14 0,0,
15 233,#poweroff
16 175,#v+
17 33,#p+
18 174,#v-
19 34,#p-
20 13,#ok
21 36,#menu
22 8,#back
23 27,#screen
24 112,#guia
25 114,#video
26 159,#gravacao
27 156,115,123,119,225,38,40,37,39,117,118,121,122,140,141,142,143,173,0,111,0];
28 meo_1_x = [24,135,242,24,139,234,22,135,242,135,26,240,242,24,242,22,242,118,112,22,99,178,260,22,133,240,22,133,240,105,103,35,230,22,101,180,225,22, 99,180,257,24,99,176,257];
29 meo_1_y = [102,102,102,188,188,188,272,272,272,358,358,358,15,481,481,698,698,557,778,838,838,838,838,933,933,933,1016,1019,1019,491,686,561,560,1120, 1124,1121,1127,1207,1204,1204,1207,1283,1285,1285,1289];
30 meo_2_x = [88,201,308,88,201,308,90,201,308,197,88,307,309,90,309,90,309,212,217,73,151,228,307,86,197,304,90,198,317,227,230,106,305,71,148,225,305,7 1,148,227,302,69,146,227,300];
31 meo_2_y = [170,170,170,254,254,254,343,343,343,426,426,426,84,549,549,768,771,673,820,889,889,889,889,999,999,999,1083,1083,1085,567,764,686,688,1175, 1178,1179,1179,1256,1256,1258,1259,1340,1337,1337,1341];
#s.send("key=112\n")#guia
36 s.send("key=233\n")#power
37 #s.send("key=36\n")#menu
38 #s.send("key=8\n")#back
39 #s.send("key=114\n")#video
40 #s.send("key=159\n")#gravacao
41 #s.send("key=115\n")#play
42 #s.send("key=111\n")#wide-smart
43 #s.send("key=173\n")#mute
44 #s.send("key=143\n")#mute
45
46 s.close()


This could be the base for some cool stuff :)