Fix Kodi crashing when casting from Plex Web
This commit is contained in:
parent
2481606cd7
commit
8830cf22db
1 changed files with 6 additions and 31 deletions
|
@ -59,10 +59,8 @@ 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
|
||||
playqueue.clear()
|
||||
return
|
||||
playqueue.clear()
|
||||
# Get new metadata for the playqueue first
|
||||
try:
|
||||
PL.get_playlist_details_from_xml(playqueue, xml)
|
||||
|
@ -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))
|
||||
playback.play_xml(playqueue,
|
||||
xml,
|
||||
offset=offset,
|
||||
start_plex_id=start_plex_id)
|
||||
|
||||
|
||||
class PlexCompanion(backgroundthread.KillableThread):
|
||||
|
|
Loading…
Reference in a new issue