Fix websocket for new json response on PMS 1.3.0

This commit is contained in:
JonnyWong16 2016-11-25 18:42:23 -08:00
commit 82ac33dd75

View file

@ -142,11 +142,12 @@ def process(opcode, data):
try: try:
info = json.loads(data) info = json.loads(data)
except Exception as ex: except Exception as e:
logger.warn(u"PlexPy WebSocket :: Error decoding message from websocket: %s" % ex) logger.warn(u"PlexPy WebSocket :: Error decoding message from websocket: %s" % e)
logger.debug(data) logger.debug(data)
return False return False
info = info.get('NotificationContainer', info)
type = info.get('type') type = info.get('type')
if not type: if not type:
@ -154,9 +155,9 @@ def process(opcode, data):
if type == 'playing': if type == 'playing':
# logger.debug('%s.playing %s' % (name, info)) # logger.debug('%s.playing %s' % (name, info))
try: time_line = info.get('PlaySessionStateNotification', info.get('_children'))
time_line = info.get('_children')
except: if not time_line:
logger.debug(u"PlexPy WebSocket :: Session found but unable to get timeline data.") logger.debug(u"PlexPy WebSocket :: Session found but unable to get timeline data.")
return False return False