From 8ab99b50362726a3c8bc49e4fe37c47770bdbce9 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Tue, 8 Mar 2016 11:47:46 +0100 Subject: [PATCH] Language strings for library sync --- resources/language/English/strings.xml | 9 +++++ resources/language/German/strings.xml | 9 +++++ resources/lib/librarysync.py | 56 +++++++++++++------------- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 79a17d17..2f2ab15e 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -396,4 +396,13 @@ Could not log in user Please try again. + + Library sync thread has crashed. You should restart Kodi now. Please report this on the forum + Detected Kodi database needs to be recreated for this version. This might take a while. Proceed? + may not work correctly until the database is reset. + Cancelling the database syncing process. Current Kodi version is unsupported. Please verify your logs for more info. + Startup syncing process failed repeatedly. Try restarting Kodi. Stopping Sync for now. + Plex playlists/nodes refreshed + Plex playlists/nodes refresh failed + diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml index e1aa564e..f3e70b34 100644 --- a/resources/language/German/strings.xml +++ b/resources/language/German/strings.xml @@ -327,4 +327,13 @@ Anmeldung fehlgeschlagen für Benutzer Bitte erneut versuchen. + + Die Synchronisierung der Plex Bibliotheken ist abgestürzt. Bitte Kodi neu starten. Danke, wenn Sie sich die Zeit nehmen und im Plex Forum vom Absturz berichten. + Die Kodi Datenbank muss neu kreiert werden für diese Version. Das kann eine Weile dauern. Fortfahren? + funktioniert möglicherweise nicht richtig, bis die Kodi Datenbank zurückgesetzt worden ist. + Synchronisierung der Plex Bibliotheken wird abgebrochen. Die momentane Kodi Version wird nicht unterstützt. Für weitere Informationen bitte das Kodi Log konsultieren. + Der Startup Synchronisations-Prozess der Plex Bibliotheken ist mehrmals fehlgeschlagen. Bitte Kodi neu starten. Synch wird jetzt gestoppt. + Plex Playlisten/Nodes aktualisiert + Plex Playlisten/Nodes Aktualisierung fehlgeschlagen + diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 0ad027ea..a630aab3 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -8,6 +8,7 @@ import Queue import xbmc import xbmcgui import xbmcvfs +import xbmcaddon import utils import clientinfo @@ -213,6 +214,8 @@ class LibrarySync(Thread): self.__dict__ = self._shared_state + self.__language__ = xbmcaddon.Addon().getLocalizedString + self.clientInfo = clientinfo.ClientInfo() self.user = userclient.UserClient() self.emby = embyserver.Read_EmbyServer() @@ -1111,11 +1114,10 @@ class LibrarySync(Thread): self.run_internal() except Exception as e: utils.window('emby_dbScan', clear=True) + # Library sync thread has crashed xbmcgui.Dialog().ok( heading=self.addonName, - line1=("Library sync thread has crashed. " - "You should restart Kodi now. " - "Please report this on the forum.")) + line1=self.__language__(39400)) raise def run_internal(self): @@ -1129,6 +1131,7 @@ class LibrarySync(Thread): enableBackgroundSync = self.enableBackgroundSync fullSync = self.fullSync fastSync = self.fastSync + string = self.__language__ dialog = xbmcgui.Dialog() @@ -1158,17 +1161,14 @@ class LibrarySync(Thread): if not uptoDate: log("Db version out of date: %s minimum version required: " "%s" % (currentVersion, minVersion), 0) - resp = dialog.yesno( - heading="Db Version", - line1=("Detected the database needs to be recreated " - "for this version of " + self.addonName + - "Proceed?")) + # DB out of date. Proceed to recreate? + resp = dialog.yesno(heading=self.addonName, + line1=string(39401)) if not resp: log("Db version out of date! USER IGNORED!", 0) - dialog.ok( - heading=self.addonName, - line1=(self.addonName + " may not work correctly " - "until the database is reset.")) + # PKC may not work correctly until reset + dialog.ok(heading=self.addonName, + line1=(self.addonName + string(39402))) else: utils.reset() break @@ -1182,13 +1182,12 @@ class LibrarySync(Thread): if not xbmcvfs.exists(videoDb): # Database does not exists log("The current Kodi version is incompatible " - "to know which Kodi versions are supported.", 0) - dialog.ok( - heading=self.addonName, - line1=("Cancelling the database syncing process. " - "Current Kodi version: %s is unsupported. " - "Please verify your logs for more info." - % xbmc.getInfoLabel('System.BuildVersion'))) + "to know which Kodi versions are supported.", -1) + log('Current Kodi version: %s' % xbmc.getInfoLabel( + 'System.BuildVersion').decode('utf-8')) + # "Current Kodi version is unsupported, cancel lib sync" + dialog.ok(heading=self.addonName, + line1=string(39403)) break # Run start up sync @@ -1209,11 +1208,10 @@ class LibrarySync(Thread): errorcount += 1 if errorcount > 2: log("Startup full sync failed. Stopping sync", -1) - dialog.ok( - heading=self.addonName, - line1=("Startup syncing process failed repeatedly." - " Try restarting Kodi. Stopping Sync for " - "now.")) + # "Startup syncing process failed repeatedly" + # "Please restart" + dialog.ok(heading=self.addonName, + line1=string(39404)) break # Currently no db scan, so we can start a new scan @@ -1239,18 +1237,21 @@ class LibrarySync(Thread): # Kick off refresh if self.maintainViews(): # Ran successfully + log("Refresh playlists/nodes completed", 0) + # "Plex playlists/nodes refreshed" dialog.notification( heading=self.addonName, - message="Plex playlists/nodes refreshed", + message=string(39405), icon="special://home/addons/plugin.video.plexkodiconnect/icon.png", time=3000, sound=True) else: # Failed log("Refresh playlists/nodes failed", -1) + # "Plex playlists/nodes refresh failed" dialog.notification( heading=self.addonName, - message="Plex playlists/nodes refresh failed", + message=string(39406), icon=xbmcgui.NOTIFICATION_ERROR, time=3000, sound=True) @@ -1268,8 +1269,7 @@ class LibrarySync(Thread): window('emby_dbScan', value="true") if not fastSync(): # Fast sync failed or server plugin is not found - self.logMsg( - "Something went wrong, starting full sync", -1) + log("Something went wrong, starting full sync", -1) fullSync(manualrun=True) window('emby_dbScan', clear=True)