Fix Kodi crashing when casting from Plex Web

This commit is contained in:
croneter 2019-10-30 17:53:40 +01:00
parent 2481606cd7
commit 8830cf22db

View file

@ -59,9 +59,7 @@ def update_playqueue_from_PMS(playqueue,
# reconnects and Kodi is already playing something - silly, really
# For all other cases, a new playqueue is generated by Plex
LOG.debug('Update for existing playqueue detected')
new = False
else:
new = True
return
playqueue.clear()
# Get new metadata for the playqueue first
try:
@ -71,33 +69,10 @@ def update_playqueue_from_PMS(playqueue,
return
playqueue.repeat = 0 if not repeat else int(repeat)
playqueue.plex_transient_token = transient_token
if new:
playback.play_xml(playqueue,
xml,
offset=offset,
start_plex_id=start_plex_id)
return
# Updates to playqueues could potentially become a bit more ugly...
if app.APP.is_playing:
try:
playerid = js.get_player_ids()[0]
except IndexError:
LOG.error('Unexpectately could not get Kodi player id')
return
if app.PLAYSTATE.player_states[playerid]['plex_id'] == start_plex_id:
# Nothing to do - let's not seek to avoid jumps in playback
return
pos = playqueue.position_from_plex_id(start_plex_id)
LOG.debug('Skipping to position %s for %s', pos, playqueue)
js.skipto(pos)
if offset:
js.seek_to(offset)
return
# Need to initiate playback again using our existing playqueue
app.APP.player.play(playqueue.kodi_pl,
None,
False,
playqueue.position_from_plex_id(start_plex_id))
class PlexCompanion(backgroundthread.KillableThread):