mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 04:49:36 -07:00
Decode websocket data
This commit is contained in:
parent
6c8b425fb3
commit
6d23ef9105
1 changed files with 5 additions and 4 deletions
|
@ -246,6 +246,7 @@ def process(opcode, data):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
data = data.decode('utf-8')
|
||||||
logger.websocket_debug(data)
|
logger.websocket_debug(data)
|
||||||
info = json.loads(data)
|
info = json.loads(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -254,12 +255,12 @@ def process(opcode, data):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
info = info.get('NotificationContainer', info)
|
info = info.get('NotificationContainer', info)
|
||||||
type = info.get('type')
|
info_type = info.get('type')
|
||||||
|
|
||||||
if not type:
|
if not info_type:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if type == 'playing':
|
if info_type == 'playing':
|
||||||
time_line = info.get('PlaySessionStateNotification', info.get('_children', {}))
|
time_line = info.get('PlaySessionStateNotification', info.get('_children', {}))
|
||||||
|
|
||||||
if not time_line:
|
if not time_line:
|
||||||
|
@ -272,7 +273,7 @@ def process(opcode, data):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Tautulli WebSocket :: Failed to process session data: %s." % e)
|
logger.exception("Tautulli WebSocket :: Failed to process session data: %s." % e)
|
||||||
|
|
||||||
if type == 'timeline':
|
if info_type == 'timeline':
|
||||||
time_line = info.get('TimelineEntry', info.get('_children', {}))
|
time_line = info.get('TimelineEntry', info.get('_children', {}))
|
||||||
|
|
||||||
if not time_line:
|
if not time_line:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue