From a650c42cfdc4adf664fcb8379db12b75cd9303cc Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 26 May 2019 13:13:13 +0200 Subject: [PATCH] Lock playqueue activities --- resources/lib/webservice.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/resources/lib/webservice.py b/resources/lib/webservice.py index 76155672..f66b2d05 100644 --- a/resources/lib/webservice.py +++ b/resources/lib/webservice.py @@ -342,7 +342,19 @@ class QueuePlay(backgroundthread.KillableThread): return playqueue, video_widget_playback def run(self): - LOG.debug('##===---- Starting QueuePlay ----===##') + with app.APP.lock_playqueues: + LOG.debug('##===---- Starting QueuePlay ----===##') + try: + self._run() + finally: + utils.window('plex.playlist.ready', clear=True) + utils.window('plex.playlist.start', clear=True) + app.PLAYSTATE.initiated_by_plex = False + self.server.threads.remove(self) + self.server.pending = [] + LOG.debug('##===---- QueuePlay Stopped ----===##') + + def _run(self): abort = False play_folder = False playqueue, video_widget_playback = self._get_playqueue() @@ -439,10 +451,3 @@ class QueuePlay(backgroundthread.KillableThread): else: utils.window('plex.playlist.aborted', value='true') break - - utils.window('plex.playlist.ready', clear=True) - utils.window('plex.playlist.start', clear=True) - app.PLAYSTATE.initiated_by_plex = False - self.server.threads.remove(self) - self.server.pending = [] - LOG.debug('##===---- QueuePlay Stopped ----===##')