Fix KeyError on non-PKC playback startup

This commit is contained in:
croneter 2018-06-17 12:35:09 +02:00
parent 0220c84554
commit de626f5cd9

View file

@ -312,7 +312,11 @@ class KodiMonitor(xbmc.Monitor):
# element otherwise # element otherwise
self._already_slept = True self._already_slept = True
xbmc.sleep(1000) xbmc.sleep(1000)
json_item = js.get_item(playerid) try:
json_item = js.get_item(playerid)
except KeyError:
LOG.debug('No playing item returned by Kodi')
return None, None, None
LOG.debug('Kodi playing item properties: %s', json_item) LOG.debug('Kodi playing item properties: %s', json_item)
return (json_item.get('id'), return (json_item.get('id'),
json_item.get('type'), json_item.get('type'),