Finish full syncs during playbacks, don't start new ones
This commit is contained in:
parent
3b3d671f37
commit
519c9675ae
4 changed files with 12 additions and 6 deletions
|
@ -12,6 +12,14 @@ class libsync_mixin(object):
|
||||||
app.APP.suspend_threads or app.SYNC.suspend_sync)
|
app.APP.suspend_threads or app.SYNC.suspend_sync)
|
||||||
|
|
||||||
|
|
||||||
|
class fullsync_mixin(object):
|
||||||
|
def isCanceled(self):
|
||||||
|
return (self._canceled or
|
||||||
|
app.APP.stop_pkc or
|
||||||
|
app.SYNC.stop_sync or
|
||||||
|
app.APP.suspend_threads)
|
||||||
|
|
||||||
|
|
||||||
def update_kodi_library(video=True, music=True):
|
def update_kodi_library(video=True, music=True):
|
||||||
"""
|
"""
|
||||||
Updates the Kodi library and thus refreshes the Kodi views and widgets
|
Updates the Kodi library and thus refreshes the Kodi views and widgets
|
||||||
|
|
|
@ -63,7 +63,7 @@ class InitNewSection(object):
|
||||||
self.plex_type = plex_type
|
self.plex_type = plex_type
|
||||||
|
|
||||||
|
|
||||||
class FullSync(common.libsync_mixin):
|
class FullSync(common.fullsync_mixin):
|
||||||
def __init__(self, repair, callback, show_dialog):
|
def __init__(self, repair, callback, show_dialog):
|
||||||
"""
|
"""
|
||||||
repair=True: force sync EVERY item
|
repair=True: force sync EVERY item
|
||||||
|
|
|
@ -27,7 +27,7 @@ def reset_collections():
|
||||||
COLLECTION_XMLS = {}
|
COLLECTION_XMLS = {}
|
||||||
|
|
||||||
|
|
||||||
class GetMetadataTask(common.libsync_mixin, backgroundthread.Task):
|
class GetMetadataTask(common.fullsync_mixin, backgroundthread.Task):
|
||||||
"""
|
"""
|
||||||
Threaded download of Plex XML metadata for a certain library item.
|
Threaded download of Plex XML metadata for a certain library item.
|
||||||
Fills the queue with the downloaded etree XML objects
|
Fills the queue with the downloaded etree XML objects
|
||||||
|
|
|
@ -255,9 +255,6 @@ class Sync(backgroundthread.KillableThread):
|
||||||
# First sync upon PKC restart. Skipped if very first sync upon
|
# First sync upon PKC restart. Skipped if very first sync upon
|
||||||
# PKC installation has been completed
|
# PKC installation has been completed
|
||||||
LOG.info('Doing initial sync on Kodi startup')
|
LOG.info('Doing initial sync on Kodi startup')
|
||||||
if app.SYNC.suspend_sync:
|
|
||||||
LOG.warning('Forcing startup sync even if Kodi is playing')
|
|
||||||
app.SYNC.suspend_sync = False
|
|
||||||
self.start_library_sync(block=True)
|
self.start_library_sync(block=True)
|
||||||
if self.sync_successful:
|
if self.sync_successful:
|
||||||
initial_sync_done = True
|
initial_sync_done = True
|
||||||
|
@ -285,7 +282,8 @@ class Sync(backgroundthread.KillableThread):
|
||||||
|
|
||||||
# Standard syncs - don't force-show dialogs
|
# Standard syncs - don't force-show dialogs
|
||||||
now = timing.unix_timestamp()
|
now = timing.unix_timestamp()
|
||||||
if (now - self.last_full_sync > app.SYNC.full_sync_intervall):
|
if (now - self.last_full_sync > app.SYNC.full_sync_intervall and
|
||||||
|
not app.SYNC.suspend_sync):
|
||||||
LOG.info('Doing scheduled full library scan')
|
LOG.info('Doing scheduled full library scan')
|
||||||
self.start_library_sync()
|
self.start_library_sync()
|
||||||
elif now - last_time_sync > one_day_in_seconds:
|
elif now - last_time_sync > one_day_in_seconds:
|
||||||
|
|
Loading…
Reference in a new issue