Replace window var plex.playlist.start with app.PLAYSTATE var

This commit is contained in:
croneter 2019-05-26 17:41:17 +02:00
parent e204ef9849
commit 27c4c6ac38
3 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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):
"""

View file

@ -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: