Fix KeyErrors if Kodi player does not return position
- Partially fixes #481
This commit is contained in:
parent
7bf6d19708
commit
a6881a8a32
2 changed files with 9 additions and 2 deletions
|
@ -195,7 +195,10 @@ class PlexCompanion(Thread):
|
||||||
elif task['action'] == 'refreshPlayQueue':
|
elif task['action'] == 'refreshPlayQueue':
|
||||||
self._process_refresh(data)
|
self._process_refresh(data)
|
||||||
elif task['action'] == 'setStreams':
|
elif task['action'] == 'setStreams':
|
||||||
self._process_streams(data)
|
try:
|
||||||
|
self._process_streams(data)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -62,7 +62,11 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
|
||||||
return
|
return
|
||||||
playqueue = PQ.get_playqueue_from_type(
|
playqueue = PQ.get_playqueue_from_type(
|
||||||
v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[plex_type])
|
v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[plex_type])
|
||||||
pos = js.get_position(playqueue.playlistid)
|
try:
|
||||||
|
pos = js.get_position(playqueue.playlistid)
|
||||||
|
except KeyError:
|
||||||
|
LOG.warning('No position returned from Kodi player! Assuming 0')
|
||||||
|
pos = 0
|
||||||
# Can return -1 (as in "no playlist")
|
# Can return -1 (as in "no playlist")
|
||||||
pos = pos if pos != -1 else 0
|
pos = pos if pos != -1 else 0
|
||||||
LOG.debug('playQueue position %s for %s', pos, playqueue)
|
LOG.debug('playQueue position %s for %s', pos, playqueue)
|
||||||
|
|
Loading…
Reference in a new issue