Merge pull request #1024 from croneter/fix-crash
Fix Kodi crashing when casting from e.g. Plex Web or Plex for Windows
This commit is contained in:
commit
ee5a71c5ce
1 changed files with 6 additions and 31 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue