Fix rare KeyError if user is playing something somewhere else

This commit is contained in:
croneter 2019-01-19 09:22:00 +01:00
parent d2f1a34092
commit 04da3572cb

View file

@ -270,13 +270,14 @@ def process_playing(data):
PLAYSTATE_SESSIONS[session_key] = {} PLAYSTATE_SESSIONS[session_key] = {}
else: else:
# PMS is ours - get all current sessions # PMS is ours - get all current sessions
PLAYSTATE_SESSIONS.update(PF.GetPMSStatus(app.ACCOUNT.plex_token)) pms_sessions = PF.GetPMSStatus(app.ACCOUNT.plex_token)
LOG.debug('Updated current sessions. They are: %s', if session_key not in pms_sessions:
PLAYSTATE_SESSIONS)
if session_key not in PLAYSTATE_SESSIONS:
LOG.info('Session key %s still unknown! Skip ' LOG.info('Session key %s still unknown! Skip '
'playstate update', session_key) 'playstate update', session_key)
continue continue
PLAYSTATE_SESSIONS[session_key] = pms_sessions[session_key]
LOG.debug('Updated current sessions. They are: %s',
PLAYSTATE_SESSIONS)
# Attach Kodi info to the session # Attach Kodi info to the session
PLAYSTATE_SESSIONS[session_key]['kodi_id'] = typus['kodi_id'] PLAYSTATE_SESSIONS[session_key]['kodi_id'] = typus['kodi_id']
PLAYSTATE_SESSIONS[session_key]['file_id'] = typus['kodi_fileid'] PLAYSTATE_SESSIONS[session_key]['file_id'] = typus['kodi_fileid']