@@ -25,7 +25,6 @@ from optparse import OptionParser
25
25
# System path
26
26
sys .path .insert (0 , os .path .join (os .path .dirname (__file__ ), '..' , 'lib' , 'py' ))
27
27
import tvh
28
- print sys .path
29
28
30
29
# TVH imports
31
30
from tvh .htsp import HTSPClient
35
34
36
35
# Command line
37
36
optp = OptionParser ()
38
- optp .add_option ('-t ' , '--host' , default = 'localhost' ,
37
+ optp .add_option ('-a ' , '--host' , default = 'localhost' ,
39
38
help = 'Specify HTSP server hostname' )
40
39
optp .add_option ('-o' , '--port' , default = 9982 , type = 'int' ,
41
40
help = 'Specify HTSP server port' )
42
41
optp .add_option ('-u' , '--user' , default = None ,
43
42
help = 'Specify HTSP authentication username' )
44
43
optp .add_option ('-p' , '--passwd' , default = None ,
45
44
help = 'Specify HTSP authentication password' )
45
+ optp .add_option ('-e' , '--epg' , default = False , action = 'store_true' ,
46
+ help = 'Get async EPG updates' )
47
+ optp .add_option ('-t' , '--update' , default = None , type = 'int' ,
48
+ help = 'Specify when to receive updates from' )
46
49
(opts , args ) = optp .parse_args ()
47
50
48
51
# Connect
49
52
htsp = HTSPClient ((opts .host , opts .port ))
50
53
msg = htsp .hello ()
51
54
log .info ('connected to %s [%s]' % (msg ['servername' ], msg ['serverversion' ]))
55
+ log .info ('using protocol v%d' % htsp ._version )
52
56
53
57
# Authenticate
54
58
if opts .user :
55
59
htsp .authenticate (opts .user , opts .passwd )
56
60
log .info ('authenticated as %s' % opts .user )
57
61
58
62
# Enable async
59
- htsp .enableAsyncMetadata ()
63
+ args = {}
64
+ if opts .epg :
65
+ args ['epg' ] = 1
66
+ if opts .update != None :
67
+ args ['lastUpdate' ] = opts .update
68
+ htsp .enableAsyncMetadata (args )
60
69
log .info ('enabled async data' )
61
70
62
71
# Process messages
0 commit comments