Fix websocket threads not getting suspended correctly
This commit is contained in:
parent
5ffcd5782d
commit
c34f43cead
4 changed files with 27 additions and 7 deletions
|
@ -30,3 +30,11 @@ def init(entrypoint=False):
|
|||
SYNC = Sync(entrypoint)
|
||||
if not entrypoint:
|
||||
PLAYSTATE = PlayState()
|
||||
|
||||
def reload():
|
||||
"""
|
||||
Reload PKC settings from xml file, e.g. on user-switch
|
||||
"""
|
||||
global APP, SYNC
|
||||
APP.reload()
|
||||
SYNC.reload()
|
||||
|
|
|
@ -100,7 +100,6 @@ class Sync(object):
|
|||
self.artwork = utils.settings('usePlexArtwork') == 'true'
|
||||
self.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
||||
self.remap_path = utils.settings('remapSMB') == 'true'
|
||||
self.force_transcode_pix = utils.settings('force_transcode_pix') == 'true'
|
||||
self.remapSMBmovieOrg = remove_trailing_slash(utils.settings('remapSMBmovieOrg'))
|
||||
self.remapSMBmovieNew = remove_trailing_slash(utils.settings('remapSMBmovieNew'))
|
||||
self.remapSMBtvOrg = remove_trailing_slash(utils.settings('remapSMBtvOrg'))
|
||||
|
@ -111,7 +110,6 @@ class Sync(object):
|
|||
self.remapSMBphotoNew = remove_trailing_slash(utils.settings('remapSMBphotoNew'))
|
||||
self.escape_path = utils.settings('escapePath') == 'true'
|
||||
self.indicate_media_versions = utils.settings('indicate_media_versions') == "true"
|
||||
self.show_extras_instead_of_playing_trailer = utils.settings('showExtrasInsteadOfTrailer') == 'true'
|
||||
self.sync_specific_plex_playlists = utils.settings('syncSpecificPlexPlaylists') == 'true'
|
||||
self.sync_specific_kodi_playlists = utils.settings('syncSpecificKodiPlaylists') == 'true'
|
||||
self.sync_thread_number = int(utils.settings('syncThreadNumber'))
|
||||
|
@ -129,3 +127,7 @@ class Sync(object):
|
|||
self.backgroundsync_saftymargin = int(utils.settings('backgroundsync_saftyMargin'))
|
||||
|
||||
self.image_sync_notifications = utils.settings('imageSyncNotifications') == 'true'
|
||||
|
||||
self.force_transcode_pix = utils.settings('force_transcode_pix') == 'true'
|
||||
# Trailers in Kodi DB will remain UNTIL DB is reset!
|
||||
self.show_extras_instead_of_playing_trailer = utils.settings('showExtrasInsteadOfTrailer') == 'true'
|
||||
|
|
|
@ -248,6 +248,7 @@ class Service(object):
|
|||
icon='{plex}',
|
||||
time=2000,
|
||||
sound=False)
|
||||
app.reload()
|
||||
app.APP.resume_threads()
|
||||
self.auth_running = False
|
||||
|
||||
|
|
|
@ -142,9 +142,13 @@ class PMS_Websocket(WebSocket):
|
|||
"""
|
||||
def should_suspend(self):
|
||||
"""
|
||||
Returns True if the thread is suspended
|
||||
Returns True if the thread is suspended.
|
||||
"""
|
||||
return self._suspended or app.SYNC.background_sync_disabled
|
||||
suspend = self._suspended or app.SYNC.background_sync_disabled
|
||||
if suspend:
|
||||
# This thread needs to clear the Event() _is_not_suspended itself!
|
||||
self.suspend()
|
||||
return suspend
|
||||
|
||||
def getUri(self):
|
||||
if self.redirect_uri:
|
||||
|
@ -209,9 +213,14 @@ class Alexa_Websocket(WebSocket):
|
|||
"""
|
||||
Overwrite method since we need to check for plex token
|
||||
"""
|
||||
return (self._suspended or
|
||||
not app.ACCOUNT.plex_token or
|
||||
app.ACCOUNT.restricted_user)
|
||||
suspend = self._suspended or \
|
||||
not app.SYNC.enable_alexa or \
|
||||
not app.ACCOUNT.plex_token or \
|
||||
app.ACCOUNT.restricted_user
|
||||
if suspend:
|
||||
# This thread needs to clear the Event() _is_not_suspended itself!
|
||||
self.suspend()
|
||||
return suspend
|
||||
|
||||
def getUri(self):
|
||||
if self.redirect_uri:
|
||||
|
|
Loading…
Reference in a new issue