From 4d957aa4a3bccbc887d5e85e29d076df09a92cbd Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 2 Feb 2017 18:45:31 +0100 Subject: [PATCH] Better warnings when resetting the Kodi database * @Pavuucek please have a look at the Czech translation file, very bottom. Missing language tags are marked with `` --- resources/language/Czech/strings.xml | 6 +++- resources/language/English/strings.xml | 6 +++- resources/language/German/strings.xml | 6 +++- resources/lib/utils.py | 40 +++++++++++++++----------- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/resources/language/Czech/strings.xml b/resources/language/Czech/strings.xml index 6773826e..d21e6543 100644 --- a/resources/language/Czech/strings.xml +++ b/resources/language/Czech/strings.xml @@ -507,5 +507,9 @@ Aktuální Kolekce - + + Are you sure you want to reset your local Kodi database? A re-sync of the Plex data will take time afterwards. + Could not stop the database from running. Please try again later. + Remove all cached artwork? (recommended!) + Reset all PlexKodiConnect Addon settings? (this is usually NOT recommended and unnecessary!) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index da8ac678..ffc162f9 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -507,5 +507,9 @@ On Deck Collections - + + Are you sure you want to reset your local Kodi database? A re-sync of the Plex data will take time afterwards. + Could not stop the database from running. Please try again later. + Remove all cached artwork? (recommended!) + Reset all PlexKodiConnect Addon settings? (this is usually NOT recommended and unnecessary!) diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index 7a37ec37..87e39f52 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -458,5 +458,9 @@ Aktuell Kollektionen - + + Wirklich die lokale Kodi Datenbank zurücksetzen? Die anschliessende Synchronisation der Plex-Daten benötigt Zeit. + Kodi Datenbank konnte nicht gestoppt werden. Bitte später erneut versuchen. + Alle zwischengespeicherten Bilder löschen? (empfohlen!) + Alle PlexKodiConnect Einstellungen zurücksetzen? (normalerweise NICHT empfohlen und nicht nötig!) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 6d9dae88..e7931e32 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -306,11 +306,12 @@ def setScreensaver(value): log.debug("Toggling screensaver: %s %s" % (value, xbmc.executeJSONRPC(dumps(query)))) + def reset(): - - dialog = xbmcgui.Dialog() - - if dialog.yesno("Warning", "Are you sure you want to reset your local Kodi database?") == 0: + # 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 @@ -320,7 +321,10 @@ def reset(): log.debug("Sync is running, will retry: %s..." % count) count -= 1 if count == 0: - dialog.ok("Warning", "Could not stop the database from running. Try again.") + # 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) @@ -371,9 +375,10 @@ def reset(): connection.commit() cursor.close() - # Offer to wipe cached thumbnails - resp = dialog.yesno("Warning", "Remove all cached artwork?") - if resp: + # 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 = tryDecode(xbmc.translatePath("special://thumbnails/")) @@ -390,7 +395,6 @@ def reset(): xbmcvfs.delete(os_path.join( tryEncode(path) + dir, file)) - # remove all existing data from texture DB connection = kodiSQL('texture') cursor = connection.cursor() @@ -406,21 +410,25 @@ def reset(): # reset the install run flag settings('SyncInstallRunDone', value="false") - # Remove emby info - resp = dialog.yesno("Warning", "Reset all Plex KodiConnect Addon settings?") - if resp: + # Reset all PlexKodiConnect Addon settings? (this is usually NOT + # recommended and unnecessary!) + if dialog('yesno', + heading='{plex} %s ' % language(30132), + line1=language(39603)): # Delete the settings addon = xbmcaddon.Addon() addondir = tryDecode(xbmc.translatePath(addon.getAddonInfo('profile'))) dataPath = "%ssettings.xml" % addondir - xbmcvfs.delete(tryEncode(dataPath)) log.info("Deleting: settings.xml") + xbmcvfs.delete(tryEncode(dataPath)) - dialog.ok( - heading=language(29999), - line1="Database reset has completed, Kodi will now restart to apply the changes.") + # Kodi will now restart to apply the changes. + dialog('ok', + heading='{plex} %s ' % language(30132), + line1=language(33033)) xbmc.executebuiltin('RestartApp') + def profiling(sortby="cumulative"): # Will print results to Kodi log def decorator(func):