Optimize startup of additional fanart sync

This commit is contained in:
croneter 2018-05-13 14:42:58 +02:00
parent 9b2291dd47
commit f8560aec4d

View file

@ -1375,6 +1375,8 @@ class LibrarySync(Thread):
missing_only=True False will start look-up for EVERY item missing_only=True False will start look-up for EVERY item
refresh=False True will force refresh all external fanart refresh=False True will force refresh all external fanart
""" """
if settings('FanartTV') == 'false':
return
with plexdb.Get_Plex_DB() as plex_db: with plexdb.Get_Plex_DB() as plex_db:
if missing_only: if missing_only:
with plexdb.Get_Plex_DB() as plex_db: with plexdb.Get_Plex_DB() as plex_db:
@ -1541,14 +1543,13 @@ class LibrarySync(Thread):
initial_sync_done = True initial_sync_done = True
kodi_db_version_checked = True kodi_db_version_checked = True
last_sync = utils.unix_timestamp() last_sync = utils.unix_timestamp()
self.sync_fanart()
self.fanartthread.start() self.fanartthread.start()
else: else:
LOG.error('Initial start-up full sync unsuccessful') LOG.error('Initial start-up full sync unsuccessful')
xbmc.executebuiltin('InhibitIdleShutdown(false)') xbmc.executebuiltin('InhibitIdleShutdown(false)')
window('plex_dbScan', clear=True) window('plex_dbScan', clear=True)
state.DB_SCAN = False state.DB_SCAN = False
if settings('FanartTV') == 'true':
self.sync_fanart()
elif not kodi_db_version_checked: elif not kodi_db_version_checked:
# Install sync was already done, don't force-show dialogs # Install sync was already done, don't force-show dialogs
@ -1582,10 +1583,9 @@ class LibrarySync(Thread):
if self.full_sync(): if self.full_sync():
initial_sync_done = True initial_sync_done = True
last_sync = utils.unix_timestamp() last_sync = utils.unix_timestamp()
if settings('FanartTV') == 'true':
self.sync_fanart()
LOG.info('Done initial sync on Kodi startup') LOG.info('Done initial sync on Kodi startup')
artwork.Artwork().cache_major_artwork() artwork.Artwork().cache_major_artwork()
self.sync_fanart()
self.fanartthread.start() self.fanartthread.start()
else: else:
LOG.info('Startup sync has not yet been successful') LOG.info('Startup sync has not yet been successful')