diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index c90d6e30..052b4332 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -72,3 +72,6 @@ class PlayState(object): # signal only when the currently playing item that called the # webservice has successfully been processed self.playlist_ready = False + # Flag for Kodimonitor to check when the correct item has been + # processed and the Playlist.OnAdd signal has been received + self.playlist_start_pos = None diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 4112fef1..75727da7 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -147,10 +147,10 @@ class KodiMonitor(xbmc.Monitor): if data['position'] == 0: self.playlistid = data['playlistid'] - if utils.window('plex.playlist.start') and data['position'] == int(utils.window('plex.playlist.start')): + if app.PLAYSTATE.playlist_start_pos == data['position']: LOG.debug('Playlist ready') app.PLAYSTATE.playlist_ready = True - utils.window('plex.playlist.start', clear=True) + app.PLAYSTATE.playlist_start_pos = None def _playlist_onremove(self, data): """ diff --git a/resources/lib/webservice.py b/resources/lib/webservice.py index 73957b5b..a771554f 100644 --- a/resources/lib/webservice.py +++ b/resources/lib/webservice.py @@ -350,7 +350,7 @@ class QueuePlay(backgroundthread.KillableThread): self._run() finally: app.PLAYSTATE.playlist_ready = False - utils.window('plex.playlist.start', clear=True) + app.PLAYSTATE.playlist_start_pos = None app.PLAYSTATE.initiated_by_plex = False self.server.threads.remove(self) self.server.pending = [] @@ -372,7 +372,7 @@ class QueuePlay(backgroundthread.KillableThread): # of our current playqueue position = playqueue.kodi_pl.size() # Set to start_position + 1 because first item will fail - utils.window('plex.playlist.start', str(start_position + 1)) + app.PLAYSTATE.playlist_start_pos = start_position + 1 LOG.debug('start_position %s, position %s for current playqueue: %s', start_position, position, playqueue) while True: