support: some minor updates to python lib and htspmon.
This commit is contained in:
parent
9e854347fa
commit
4c681bd70e
2 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue