From a1f1e332b321a9a251c107e3e427338ff9312999 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 14 May 2017 16:41:02 +0200 Subject: [PATCH] Revert "Try shutting down PKC more cleanly" This reverts commit 4b06a89f702eb5dab8e8e36e5761c30fbfb55c0d. --- resources/lib/kodimonitor.py | 5 ----- service.py | 15 +++++---------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 579c9033..4e19721e 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -14,7 +14,6 @@ from PlexFunctions import scrobble from kodidb_functions import get_kodiid_from_filename from PlexAPI import API from variables import REMAP_TYPE_FROM_PLEXTYPE -import state ############################################################################### @@ -138,10 +137,6 @@ class KodiMonitor(Monitor): sleep(5000) window('plex_runLibScan', value="full") - elif method == "System.OnQuit": - log.info('Kodi OnQuit detected - shutting down') - state.STOP_PKC = True - def PlayBackStart(self, data): """ Called whenever a playback is started diff --git a/service.py b/service.py index 08119cb5..ef174ce2 100644 --- a/service.py +++ b/service.py @@ -133,16 +133,9 @@ class Service(): logLevel = 0 return logLevel - def __stop_PKC(self): - """ - Kodi's abortRequested is really unreliable :-( - """ - return self.monitor.abortRequested() or state.STOP_PKC - def ServiceEntryPoint(self): # Important: Threads depending on abortRequest will not trigger # if profile switch happens more than once. - __stop_PKC = self.__stop_PKC monitor = self.monitor kodiProfile = v.KODI_PROFILE @@ -168,7 +161,7 @@ class Service(): welcome_msg = True counter = 0 - while not __stop_PKC(): + while not monitor.abortRequested(): if tryEncode(window('plex_kodiProfile')) != kodiProfile: # Profile change happened, terminate this thread and others @@ -248,13 +241,14 @@ class Service(): # Server went offline break - if monitor.waitForAbort(3): + if monitor.waitForAbort(5): # Abort was requested while waiting. We should exit break + sleep(50) else: # Wait until Plex server is online # or Kodi is shut down. - while not self.__stop_PKC(): + while not monitor.abortRequested(): server = self.user.getServer() if server is False: # No server info set in add-on settings @@ -322,6 +316,7 @@ class Service(): if monitor.waitForAbort(0.05): # Abort was requested while waiting. We should exit break + # Terminating PlexKodiConnect # Tell all threads to terminate (e.g. several lib sync threads)