Fix wierd behavior upon switching to another PMS

This commit is contained in:
croneter 2018-12-09 15:25:30 +01:00
parent 1cc8cb7ad3
commit adeeee7162
2 changed files with 19 additions and 8 deletions

View file

@ -213,14 +213,8 @@ class Sync(backgroundthread.KillableThread):
else:
utils.reset(ask_user=False)
return
# Ensure that Plex DB is set-up
plex_db.initialize()
# Hack to speed up look-ups for actors (giant table!)
utils.create_kodi_db_indicees()
kodi_db.setup_kodi_default_entries()
with kodi_db.KodiVideoDB() as kodidb:
# Setup the paths for addon-paths (even when using direct paths)
kodidb.setup_path_table()
utils.init_dbs()
while not self.isCanceled():
# In the event the server goes offline

View file

@ -482,6 +482,23 @@ def wipe_database():
settings('SyncInstallRunDone', value="false")
settings('lastfullsync', value="0")
LOG.info('Wiping done')
init_dbs()
def init_dbs():
"""
Call e.g. on startup to ensure that Plex and Kodi DBs look like they should
"""
from . import kodi_db, plex_db
# Ensure that Plex DB is set-up
plex_db.initialize()
# Hack to speed up look-ups for actors (giant table!)
create_kodi_db_indicees()
kodi_db.setup_kodi_default_entries()
with kodi_db.KodiVideoDB() as kodidb:
# Setup the paths for addon-paths (even when using direct paths)
kodidb.setup_path_table()
LOG.info('Init DBs done')
def reset(ask_user=True):