Code cleanup

This commit is contained in:
croneter 2018-11-05 14:03:19 +01:00
parent 6e83a549d3
commit f321baab82

View file

@ -4,13 +4,10 @@ from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import xbmc import xbmc
from . import library_sync
from .downloadutils import DownloadUtils as DU from .downloadutils import DownloadUtils as DU
from . import backgroundthread, utils, path_ops from . import library_sync
from . import backgroundthread, utils, path_ops, artwork, variables as v, state
from . import plex_db, kodidb_functions as kodidb from . import plex_db, kodidb_functions as kodidb
from . import artwork
from . import variables as v, state
LOG = getLogger('PLEX.sync') LOG = getLogger('PLEX.sync')
@ -36,7 +33,6 @@ class Sync(backgroundthread.KillableThread):
self.sync_successful = False self.sync_successful = False
self.last_full_sync = 0 self.last_full_sync = 0
self.fanart = None self.fanart = None
# How long should we wait at least to process new/changed PMS items?
# Show sync dialog even if user deactivated? # Show sync dialog even if user deactivated?
self.force_dialog = False self.force_dialog = False
# Lock used to wait on a full sync, e.g. on initial sync # Lock used to wait on a full sync, e.g. on initial sync
@ -44,7 +40,7 @@ class Sync(backgroundthread.KillableThread):
super(Sync, self).__init__() super(Sync, self).__init__()
def isCanceled(self): def isCanceled(self):
return xbmc.abortRequested or state.STOP_PKC return state.STOP_PKC
def isSuspended(self): def isSuspended(self):
return state.SUSPEND_LIBRARY_THREAD or state.STOP_SYNC return state.SUSPEND_LIBRARY_THREAD or state.STOP_SYNC
@ -173,7 +169,7 @@ class Sync(backgroundthread.KillableThread):
raise raise
def _run_internal(self): def _run_internal(self):
LOG.info("---===### Starting Sync ###===---") LOG.info("---===### Starting Sync Thread ###===---")
install_sync_done = utils.settings('SyncInstallRunDone') == 'true' install_sync_done = utils.settings('SyncInstallRunDone') == 'true'
playlist_monitor = None playlist_monitor = None
initial_sync_done = False initial_sync_done = False
@ -225,7 +221,7 @@ class Sync(backgroundthread.KillableThread):
while self.isSuspended(): while self.isSuspended():
if self.isCanceled(): if self.isCanceled():
# Abort was requested while waiting. We should exit # Abort was requested while waiting. We should exit
LOG.info("###===--- Sync Stopped ---===###") LOG.info("###===--- Sync Thread Stopped ---===###")
return return
xbmc.sleep(1000) xbmc.sleep(1000)
@ -342,4 +338,4 @@ class Sync(backgroundthread.KillableThread):
DU().stopSession() DU().stopSession()
except AttributeError: except AttributeError:
pass pass
LOG.info("###===--- Sync Stopped ---===###") LOG.info("###===--- Sync Thread Stopped ---===###")