Don't restart Kodi if user chose to enter PKC settings on install

This commit is contained in:
croneter 2019-06-15 16:01:02 +02:00
parent 966d368261
commit b99b17d0f9
2 changed files with 9 additions and 10 deletions

View file

@ -693,14 +693,12 @@ class InitialSetup(object):
# Open Settings page now? You will need to restart! # Open Settings page now? You will need to restart!
goto_settings = utils.yesno_dialog(utils.lang(29999), goto_settings = utils.yesno_dialog(utils.lang(29999),
utils.lang(39017)) utils.lang(39017))
# New installation - make sure we start with a clean slate
utils.wipe_database(reboot=False)
if goto_settings: if goto_settings:
LOG.info('User chose to go to the PKC settings - suspending PKC')
app.APP.stop_pkc = True app.APP.stop_pkc = True
executebuiltin( executebuiltin(
'Addon.OpenSettings(plugin.video.plexkodiconnect)') 'Addon.OpenSettings(plugin.video.plexkodiconnect)')
# New installation - make sure we start with a clean slate return
# Will trigger a reboot, usually utils.reboot_kodi()
utils.wipe_database()
# Reload relevant settings if that is not the case
app.CONN.load()
app.ACCOUNT.load()
app.SYNC.load()

View file

@ -539,7 +539,7 @@ def create_kodi_db_indicees():
conn.close() conn.close()
def wipe_database(): def wipe_database(reboot=True):
""" """
Deletes all Plex playlists as well as video nodes, then clears Kodi as well Deletes all Plex playlists as well as video nodes, then clears Kodi as well
as Plex databases completely. as Plex databases completely.
@ -585,10 +585,11 @@ def wipe_database():
settings('sections_asked_for_machine_identifier', value='') settings('sections_asked_for_machine_identifier', value='')
init_dbs() init_dbs()
LOG.info('Wiping done') LOG.info('Wiping done')
if settings('kodi_db_has_been_wiped_clean') != 'true': no_reboot = settings('kodi_db_has_been_wiped_clean') == 'true' or not reboot
settings('kodi_db_has_been_wiped_clean', value='true')
if not no_reboot:
# Root cause is sqlite WAL mode - Kodi might still have DB access open # Root cause is sqlite WAL mode - Kodi might still have DB access open
LOG.warn('Need to restart Kodi before filling Kodi DB again') LOG.warn('Need to restart Kodi before filling Kodi DB again')
settings('kodi_db_has_been_wiped_clean', value='true')
reboot_kodi() reboot_kodi()