Greatly speed up switch of PMS
This commit is contained in:
parent
ae15030bb5
commit
f31046bed1
3 changed files with 53 additions and 56 deletions
|
@ -1851,10 +1851,6 @@ msgctxt "#39601"
|
|||
msgid "Could not stop the database from running. Please try again later."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#39602"
|
||||
msgid "Remove all cached artwork? (recommended!)"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#39603"
|
||||
msgid "Reset all PlexKodiConnect Addon settings? (this is usually NOT recommended and unnecessary!)"
|
||||
msgstr ""
|
||||
|
|
|
@ -53,11 +53,9 @@ def chooseServer():
|
|||
if not __LogOut():
|
||||
return
|
||||
|
||||
from utils import delete_playlists, delete_nodes
|
||||
# First remove playlists
|
||||
delete_playlists()
|
||||
# Remove video nodes
|
||||
delete_nodes()
|
||||
from utils import wipe_database
|
||||
# Wipe Kodi and Plex database as well as playlists and video nodes
|
||||
wipe_database()
|
||||
|
||||
# Log in again
|
||||
__LogIn()
|
||||
|
|
|
@ -368,34 +368,14 @@ def create_actor_db_index():
|
|||
conn.close()
|
||||
|
||||
|
||||
def reset():
|
||||
def wipe_database():
|
||||
"""
|
||||
User navigated to the PKC settings, Advanced, and wants to reset the Kodi
|
||||
database and possibly PKC entirely
|
||||
Deletes all Plex playlists as well as video nodes, then clears Kodi as well
|
||||
as Plex databases completely.
|
||||
Will also delete all cached artwork.
|
||||
"""
|
||||
# Are you sure you want to reset your local Kodi database?
|
||||
if not dialog('yesno',
|
||||
heading='{plex} %s ' % language(30132),
|
||||
line1=language(39600)):
|
||||
return
|
||||
|
||||
# first stop any db sync
|
||||
plex_command('STOP_SYNC', 'True')
|
||||
count = 10
|
||||
while window('plex_dbScan') == "true":
|
||||
LOG.debug("Sync is running, will retry: %s...", count)
|
||||
count -= 1
|
||||
if count == 0:
|
||||
# Could not stop the database from running. Please try again later.
|
||||
dialog('ok',
|
||||
heading='{plex} %s' % language(30132),
|
||||
line1=language(39601))
|
||||
return
|
||||
xbmc.sleep(1000)
|
||||
|
||||
# Clean up the playlists
|
||||
delete_playlists()
|
||||
|
||||
# Clean up the video nodes
|
||||
delete_nodes()
|
||||
|
||||
|
@ -435,15 +415,9 @@ def reset():
|
|||
tablename = row[0]
|
||||
if tablename != "version":
|
||||
cursor.execute("DELETE FROM %s" % tablename)
|
||||
cursor.execute('DROP table IF EXISTS plex')
|
||||
cursor.execute('DROP table IF EXISTS view')
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
|
||||
# Remove all cached artwork? (recommended!)
|
||||
if dialog('yesno',
|
||||
heading='{plex} %s ' % language(30132),
|
||||
line1=language(39602)):
|
||||
LOG.info("Resetting all cached artwork.")
|
||||
# Remove all existing textures first
|
||||
path = xbmc.translatePath("special://thumbnails/")
|
||||
|
@ -465,6 +439,35 @@ def reset():
|
|||
# reset the install run flag
|
||||
settings('SyncInstallRunDone', value="false")
|
||||
|
||||
|
||||
def reset():
|
||||
"""
|
||||
User navigated to the PKC settings, Advanced, and wants to reset the Kodi
|
||||
database and possibly PKC entirely
|
||||
"""
|
||||
# Are you sure you want to reset your local Kodi database?
|
||||
if not dialog('yesno',
|
||||
heading='{plex} %s ' % language(30132),
|
||||
line1=language(39600)):
|
||||
return
|
||||
|
||||
# first stop any db sync
|
||||
plex_command('STOP_SYNC', 'True')
|
||||
count = 10
|
||||
while window('plex_dbScan') == "true":
|
||||
LOG.debug("Sync is running, will retry: %s...", count)
|
||||
count -= 1
|
||||
if count == 0:
|
||||
# Could not stop the database from running. Please try again later.
|
||||
dialog('ok',
|
||||
heading='{plex} %s' % language(30132),
|
||||
line1=language(39601))
|
||||
return
|
||||
xbmc.sleep(1000)
|
||||
|
||||
# Wipe everything
|
||||
wipe_database()
|
||||
|
||||
# Reset all PlexKodiConnect Addon settings? (this is usually NOT
|
||||
# recommended and unnecessary!)
|
||||
if dialog('yesno',
|
||||
|
|
Loading…
Reference in a new issue