From 8830cf22db8d4edc5d9def2cea52fb81d9b70a4e Mon Sep 17 00:00:00 2001 From: croneter Date: Wed, 30 Oct 2019 17:53:40 +0100 Subject: [PATCH] Fix Kodi crashing when casting from Plex Web --- resources/lib/plex_companion.py | 37 ++++++--------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/resources/lib/plex_companion.py b/resources/lib/plex_companion.py index 80ab3bd2..fd3b46ed 100644 --- a/resources/lib/plex_companion.py +++ b/resources/lib/plex_companion.py @@ -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):