From e31e531f9c6ba3a73ca98bf587f405dfbf4865fa Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Fri, 25 Nov 2016 21:06:43 -0800 Subject: [PATCH] Fix websocket timeline json --- plexpy/web_socket.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py index ce20b707..3d7160a2 100644 --- a/plexpy/web_socket.py +++ b/plexpy/web_socket.py @@ -178,8 +178,7 @@ def process(opcode, data): return False if type == 'playing': - # logger.debug('%s.playing %s' % (name, info)) - time_line = info.get('PlaySessionStateNotification', info.get('_children')) + time_line = info.get('PlaySessionStateNotification', info.get('_children', {})) if not time_line: logger.debug(u"PlexPy WebSocket :: Session found but unable to get timeline data.") @@ -189,13 +188,13 @@ def process(opcode, data): activity.process() if type == 'timeline': - try: - children = info.get('_children') - except: + time_line = info.get('TimelineEntry', info.get('_children', {})) + + if not time_line: logger.debug(u"PlexPy WebSocket :: Timeline event found but unable to get timeline data.") return False - activity = activity_handler.TimelineHandler(timeline=children[0]) + activity = activity_handler.TimelineHandler(timeline=time_line[0]) activity.process() return True