Skip to content

Commit a0b141a

Browse files
committedSep 21, 2012
Updated htspmon debug script to receive EPG info.
1 parent c2b967f commit a0b141a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed
 

Diff for: ‎lib/py/tvh/htsp.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# HTSP Client
3030
# ###########################################################################
3131

32-
HTSP_PROTO_VERSION = 5
32+
HTSP_PROTO_VERSION = 6
3333

3434
# Create passwd digest
3535
def htsp_digest ( user, passwd, chal ):
@@ -76,10 +76,9 @@ def hello ( self ):
7676
self.send('hello', args)
7777
resp = self.recv()
7878

79-
# Validate
80-
if resp['htspversion'] != HTSP_PROTO_VERSION:
81-
raise Exception('version mismatch')
82-
self._auth = resp['challenge']
79+
# Store
80+
self._version = min(HTSP_PROTO_VERSION, resp['htspversion'])
81+
self._auth = resp['challenge']
8382

8483
# Return response
8584
return resp
@@ -95,8 +94,8 @@ def authenticate ( self, user, passwd = None ):
9594
raise Exception('Authentication failed')
9695

9796
# Enable async receive
98-
def enableAsyncMetadata ( self ):
99-
self.send('enableAsyncMetadata')
97+
def enableAsyncMetadata ( self, args = {} ):
98+
self.send('enableAsyncMetadata', args)
10099

101100
# ############################################################################
102101
# Editor Configuration

Diff for: ‎support/htspmon

+12-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ from optparse import OptionParser
2525
# System path
2626
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib', 'py'))
2727
import tvh
28-
print sys.path
2928

3029
# TVH imports
3130
from tvh.htsp import HTSPClient
@@ -35,28 +34,38 @@ try:
3534

3635
# Command line
3736
optp = OptionParser()
38-
optp.add_option('-t', '--host', default='localhost',
37+
optp.add_option('-a', '--host', default='localhost',
3938
help='Specify HTSP server hostname')
4039
optp.add_option('-o', '--port', default=9982, type='int',
4140
help='Specify HTSP server port')
4241
optp.add_option('-u', '--user', default=None,
4342
help='Specify HTSP authentication username')
4443
optp.add_option('-p', '--passwd', default=None,
4544
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')
4649
(opts, args) = optp.parse_args()
4750

4851
# Connect
4952
htsp = HTSPClient((opts.host, opts.port))
5053
msg = htsp.hello()
5154
log.info('connected to %s [%s]' % (msg['servername'], msg['serverversion']))
55+
log.info('using protocol v%d' % htsp._version)
5256

5357
# Authenticate
5458
if opts.user:
5559
htsp.authenticate(opts.user, opts.passwd)
5660
log.info('authenticated as %s' % opts.user)
5761

5862
# 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)
6069
log.info('enabled async data')
6170

6271
# Process messages

0 commit comments

Comments
 (0)