From: Adam Sutton Date: Sat, 5 Jan 2013 19:12:09 +0000 (+0000) Subject: support: some minor updates to python lib and htspmon. X-Git-Tag: v3.5~197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c681bd70ee42d0b0ba40fe62c61eff21f8835fe;p=thirdparty%2Ftvheadend.git support: some minor updates to python lib and htspmon. --- diff --git a/lib/py/tvh/htsmsg.py b/lib/py/tvh/htsmsg.py index 2c2917901..dc7d50881 100644 --- a/lib/py/tvh/htsmsg.py +++ b/lib/py/tvh/htsmsg.py @@ -129,8 +129,12 @@ def serialize ( msg ): return int2bin(cnt) + binary_write(msg) # Deserialize an htsmsg -def deserialize0 ( data ): - msg = {} +def deserialize0 ( data, typ = HMF_MAP ): + islist = False + msg = {} + if (typ == HMF_LIST): + islist = True + msg = [] while len(data) > 5: typ = ord(data[0]) nlen = ord(data[1]) @@ -152,10 +156,13 @@ def deserialize0 ( data ): item = (item << 8) | ord(data[i]) i = i - 1 elif typ in [ HMF_LIST, HMF_MAP ]: - item = deserialize0(data[:dlen]) + item = deserialize0(data[:dlen], typ) else: raise Exception('invalid data type %d' % typ) - msg[name] = item + if islist: + msg.append(item) + else: + msg[name] = item data = data[dlen:] return msg diff --git a/support/htspmon b/support/htspmon index dd4380c2b..787f45c7b 100755 --- a/support/htspmon +++ b/support/htspmon @@ -53,6 +53,10 @@ try: msg = htsp.hello() log.info('connected to %s [%s]' % (msg['servername'], msg['serverversion'])) log.info('using protocol v%d' % htsp._version) + cap = [] + if 'servercapability' in msg: + cap = msg['servercapability'] + log.info('capabilities [%s]' % ','.join(cap)) # Authenticate if opts.user: