Revert "Try shutting down PKC more cleanly"

This reverts commit 4b06a89f70.
This commit is contained in:
tomkat83 2017-05-14 16:41:02 +02:00
parent 219aa2d0ab
commit a1f1e332b3
2 changed files with 5 additions and 15 deletions

View file

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

View file

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