Fix and optimize startup of playlist sync
This commit is contained in:
parent
f9571f009b
commit
080e9184cc
2 changed files with 11 additions and 6 deletions
|
@ -262,9 +262,10 @@ class LibrarySync(Thread):
|
|||
# This will NOT update playstates and userratings!
|
||||
LOG.info('Running fullsync for CHANGED PMS items with repair=%s',
|
||||
repair)
|
||||
if self._full_sync() is False:
|
||||
if not self._full_sync():
|
||||
return False
|
||||
if not playlists.full_sync():
|
||||
return False
|
||||
playlists.full_sync()
|
||||
return True
|
||||
|
||||
def _full_sync(self):
|
||||
|
@ -1561,10 +1562,9 @@ class LibrarySync(Thread):
|
|||
initial_sync_done = True
|
||||
kodi_db_version_checked = True
|
||||
last_sync = utils.unix_timestamp()
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
self.sync_fanart()
|
||||
self.fanartthread.start()
|
||||
if state.SYNC_PLAYLISTS and playlists.full_sync():
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
else:
|
||||
LOG.error('Initial start-up full sync unsuccessful')
|
||||
xbmc.executebuiltin('InhibitIdleShutdown(false)')
|
||||
|
@ -1614,11 +1614,10 @@ class LibrarySync(Thread):
|
|||
initial_sync_done = True
|
||||
last_sync = utils.unix_timestamp()
|
||||
LOG.info('Done initial sync on Kodi startup')
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
artwork.Artwork().cache_major_artwork()
|
||||
self.sync_fanart()
|
||||
self.fanartthread.start()
|
||||
if state.SYNC_PLAYLISTS and playlists.full_sync():
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
else:
|
||||
LOG.info('Startup sync has not yet been successful')
|
||||
utils.window('plex_dbScan', clear=True)
|
||||
|
|
|
@ -329,6 +329,9 @@ def full_sync():
|
|||
Full sync of playlists between Kodi and Plex. Returns True is successful,
|
||||
False otherwise
|
||||
"""
|
||||
if not state.SYNC_PLAYLISTS:
|
||||
LOG.debug('Not syncing playlists')
|
||||
return True
|
||||
LOG.info('Starting playlist full sync')
|
||||
with state.LOCK_PLAYLISTS:
|
||||
return _full_sync()
|
||||
|
@ -467,6 +470,9 @@ class PlaylistEventhandler(events.FileSystemEventHandler):
|
|||
:type event:
|
||||
:class:`FileSystemEvent`
|
||||
"""
|
||||
if not state.SYNC_PLAYLISTS:
|
||||
# Sync is deactivated
|
||||
return
|
||||
if event.is_directory:
|
||||
# todo: take care of folder renames
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue