Fix disabling of background sync (websockets)

- Partially fixes #425
This commit is contained in:
croneter 2018-03-10 12:58:11 +01:00
parent 344e4337e1
commit d74c26fd4c
5 changed files with 9 additions and 7 deletions

View file

@ -60,8 +60,8 @@ def reload_pkc():
state.SYNC_THREAD_NUMBER = int(settings('syncThreadNumber'))
state.SYNC_DIALOG = settings('dbSyncIndicator') == 'true'
state.ENABLE_MUSIC = settings('enableMusic') == 'true'
state.BACKGROUND_SYNC = settings(
'enableBackgroundSync') == 'true'
state.BACKGROUND_SYNC_DISABLED = settings(
'enableBackgroundSync') == 'false'
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
settings('backgroundsync_saftyMargin'))
state.REPLACE_SMB_PATH = settings('replaceSMB') == 'true'

View file

@ -46,7 +46,6 @@ STATE_SETTINGS = {
'remapSMBphotoOrg': 'remapSMBphotoOrg',
'remapSMBphotoNew': 'remapSMBphotoNew',
'enableMusic': 'ENABLE_MUSIC',
'enableBackgroundSync': 'BACKGROUND_SYNC',
'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER'
}
@ -111,6 +110,8 @@ class KodiMonitor(Monitor):
plex_command('RUN_LIB_SCAN', 'views')
# Special cases, overwrite all internal settings
set_replace_paths()
state.BACKGROUND_SYNC_DISABLED = settings(
'enableBackgroundSync') == 'false'
state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval')) * 60
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
settings('backgroundsync_saftyMargin'))

View file

@ -1621,7 +1621,7 @@ class LibrarySync(Thread):
self.syncPMStime()
window('plex_dbScan', clear=True)
state.DB_SCAN = False
elif state.BACKGROUND_SYNC:
elif not state.BACKGROUND_SYNC_DISABLED:
# Check back whether we should process something
# Only do this once every while (otherwise, potentially
# many screen refreshes lead to flickering)

View file

@ -40,8 +40,8 @@ KODI_DB_CHECKED = False
ENABLE_MUSIC = True
# How often shall we sync?
FULL_SYNC_INTERVALL = 0
# Background Sync enabled at all?
BACKGROUND_SYNC = True
# Background Sync disabled?
BACKGROUND_SYNC_DISABLED = False
# How long shall we wait with synching a new item to make sure Plex got all
# metadata?
BACKGROUNDSYNC_SAFTYMARGIN = 0

View file

@ -141,7 +141,8 @@ class WebSocket(Thread):
LOG.info("##===---- %s Stopped ----===##", self.__class__.__name__)
@thread_methods(add_suspends=['SUSPEND_LIBRARY_THREAD'])
@thread_methods(add_suspends=['SUSPEND_LIBRARY_THREAD',
'BACKGROUND_SYNC_DISABLED'])
class PMS_Websocket(WebSocket):
"""
Websocket connection with the PMS for Plex Companion