Fix data parsing from TS3 server

Problem happened when we tried to extend the data list from the dict, it just uses
the keynames. Also if we have only one entry return the raw dict instead of a list
This commit is contained in:
2010-10-07 11:24:08 +01:00
parent 909ea46881
commit a3a9e864aa

10
ts3.py
View File

@@ -66,13 +66,16 @@ class TS3Proto():
resp = self._sockfile.readline()
resp = self.parse_command(resp)
if not 'command' in resp:
data.extend(resp)
data.append(resp)
else:
break
if resp['command'] == 'error':
if data and resp['keys']['id'] == '0':
return data
if len(data) > 1:
return data
else:
return data[0]
else:
return resp['keys']['id']
@@ -90,8 +93,7 @@ class TS3Proto():
@type opts: list
"""
cstr = []
cstr.append(command)
cstr = [command]
# Add the keys and values, escape as needed
if keys: