Only remember which player has been active if we got a Plex id

This commit is contained in:
croneter 2018-04-02 17:09:44 +02:00
parent 5facbddfc7
commit 8c5baf80ee

View file

@ -339,8 +339,6 @@ class KodiMonitor(Monitor):
except IndexError: except IndexError:
LOG.error('Could not retreive active player - aborting') LOG.error('Could not retreive active player - aborting')
return return
# Remember that this player has been active
state.ACTIVE_PLAYERS.append(playerid)
playqueue = PQ.PLAYQUEUES[playerid] playqueue = PQ.PLAYQUEUES[playerid]
info = js.get_player_props(playerid) info = js.get_player_props(playerid)
pos = info['position'] if info['position'] != -1 else 0 pos = info['position'] if info['position'] != -1 else 0
@ -402,6 +400,8 @@ class KodiMonitor(Monitor):
container_key = '/playQueues/%s' % playqueue.id container_key = '/playQueues/%s' % playqueue.id
else: else:
container_key = '/library/metadata/%s' % plex_id container_key = '/library/metadata/%s' % plex_id
# Remember that this player has been active
state.ACTIVE_PLAYERS.append(playerid)
status.update(info) status.update(info)
LOG.debug('Set the Plex container_key to: %s', container_key) LOG.debug('Set the Plex container_key to: %s', container_key)
status['container_key'] = container_key status['container_key'] = container_key