Fix KeyError on playback start

This commit is contained in:
croneter 2018-01-23 07:59:53 +01:00
parent 287b888b6f
commit e6520ad2e8

View file

@ -322,6 +322,13 @@ class KodiMonitor(Monitor):
LOG.info('Aborting playback report - item invalid for updates %s', LOG.info('Aborting playback report - item invalid for updates %s',
data) data)
return return
if playerid == -1:
# Kodi might return -1 for "last player"
try:
playerid = js.get_player_ids()[0]
except IndexError:
LOG.error('Could not retreive active player - aborting')
return
# Remember that this player has been active # Remember that this player has been active
state.ACTIVE_PLAYERS.append(playerid) state.ACTIVE_PLAYERS.append(playerid)
playqueue = PQ.PLAYQUEUES[playerid] playqueue = PQ.PLAYQUEUES[playerid]