File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,23 @@ def contact(n):
1111 return json .loads (req .read ().decode (encoding )) #res contains json data
1212
1313 #Example of parsing
14- def get_info ():
15- res = DirecTV .contact ('http://192.168.1.100 :8080/tv/getTuned' ) #10.43.112.22
14+ def get_info (ip ):
15+ res = DirecTV .contact ('http://' + ip + ' :8080/tv/getTuned' )
1616 return (str (res ['callsign' ]), str (res ['major' ]), str (res ['title' ]))
17- #print('INFO:', res['title'])
1817
19- def chng_chnl (n ):
20- url = 'http://192.168.1.100 :8080/tv/tune?major=' + n
18+ def chng_chnl (ip , n ):
19+ url = 'http://' + ip + ' :8080/tv/tune?major=' + n
2120 res = DirecTV .contact (url )
2221 return res ['status' ]['msg' ]
2322
2423 def keyInput (ip , n ):
2524 url = 'http://' + ip + ":8080/remote/processKey?key=" + n
2625 res = DirecTV .contact (url )
27- #end
28- #end
26+
27+ if __name__ == "__main__" :
28+
29+ if argv [1 ] == "info" : # Sample: directv.py info 192.168.1.5
30+ print DirecTV .get_info (argv [2 ])
31+
32+ if argv [1 ] == "channel" : # Sample: directv.py channel 192.168.1.5 206
33+ print chng_chnl (argv [2 ], argv [3 ])
You can’t perform that action at this time.
0 commit comments