From a8fd73740cf9ad210371baaffd7528b453be69c5 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sun, 19 Jun 2016 16:24:34 -0500 Subject: [PATCH] Strings --- default.py | 59 ++++++++++---------------- resources/language/English/strings.xml | 39 +++++++++++++---- resources/lib/initialsetup.py | 54 +++++++++-------------- resources/settings.xml | 2 +- service.py | 4 +- 5 files changed, 76 insertions(+), 82 deletions(-) diff --git a/default.py b/default.py index 72e3ebfa..110ae76d 100644 --- a/default.py +++ b/default.py @@ -12,32 +12,32 @@ import xbmcgui ################################################################################################# -addon_ = xbmcaddon.Addon(id='plugin.video.emby') -addon_path = addon_.getAddonInfo('path').decode('utf-8') -base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8') -sys.path.append(base_resource) +_addon = xbmcaddon.Addon(id='plugin.video.emby') +_addon_path = _addon.getAddonInfo('path').decode('utf-8') +_base_resource = xbmc.translatePath(os.path.join(_addon_path, 'resources', 'lib')).decode('utf-8') +sys.path.append(_base_resource) ################################################################################################# import entrypoint import utils -from utils import Logging, window +from utils import Logging, window, language as lang +log = Logging('Default').log ################################################################################################# -log = Logging('Default').log -enableProfiling = False -class Main: +class Main(): # MAIN ENTRY POINT + #@utils.profiling() def __init__(self): # Parse parameters base_url = sys.argv[0] params = urlparse.parse_qs(sys.argv[2][1:]) - xbmc.log("Parameter string: %s" % sys.argv[2]) + log("Parameter string: %s" % sys.argv[2], 0) try: mode = params['mode'][0] itemid = params.get('id') @@ -72,11 +72,13 @@ class Main: embypath = sys.argv[2][1:] embyid = params.get('id',[""])[0] entrypoint.getExtraFanArt(embyid,embypath) + return if "/Extras" in sys.argv[0] or "/VideoFiles" in sys.argv[0]: embypath = sys.argv[2][1:] embyid = params.get('id',[""])[0] - entrypoint.getVideoFiles(embyid,embypath) + entrypoint.getVideoFiles(embyid, embypath) + return if modes.get(mode): # Simple functions @@ -88,11 +90,11 @@ class Main: limit = int(params['limit'][0]) modes[mode](itemid, limit) - elif mode in ["channels","getsubfolders"]: + elif mode in ("channels","getsubfolders"): modes[mode](itemid) elif mode == "browsecontent": - modes[mode]( itemid, params.get('type',[""])[0], params.get('folderid',[""])[0] ) + modes[mode](itemid, params.get('type',[""])[0], params.get('folderid',[""])[0]) elif mode == "channelsfolder": folderid = params['folderid'][0] @@ -104,12 +106,13 @@ class Main: # Other functions if mode == "settings": xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)') + elif mode in ("manualsync", "fastsync", "repair"): + if window('emby_online') != "true": # Server is not online, do not run the sync - xbmcgui.Dialog().ok(heading="Emby for Kodi", - line1=("Unable to run the sync, the add-on is not " - "connected to the Emby server.")) + xbmcgui.Dialog().ok(heading=lang(29999), + line1=lang(33034)) log("Not connected to the emby server.", 1) return @@ -128,30 +131,12 @@ class Main: elif mode == "texturecache": import artwork artwork.Artwork().FullTextureCacheSync() + else: entrypoint.doMainListing() - -if ( __name__ == "__main__" ): + +if __name__ == "__main__": log('plugin.video.emby started', 1) - - if enableProfiling: - import cProfile - import pstats - import random - from time import gmtime, strftime - addonid = addon_.getAddonInfo('id').decode( 'utf-8' ) - datapath = os.path.join( xbmc.translatePath( "special://profile/" ).decode( 'utf-8' ), "addon_data", addonid ) - - filename = os.path.join( datapath, strftime( "%Y%m%d%H%M%S",gmtime() ) + "-" + str( random.randrange(0,100000) ) + ".log" ) - cProfile.run( 'Main()', filename ) - - stream = open( filename + ".txt", 'w') - p = pstats.Stats( filename, stream = stream ) - p.sort_stats( "cumulative" ) - p.print_stats() - - else: - Main() - + Main() log('plugin.video.emby stopped', 1) \ No newline at end of file diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 1a145adc..b15b7fe8 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -1,25 +1,30 @@  + + Emby for Kodi Primary Server Address Play from HTTP instead of SMB Log level - Username: - Password: + Username + Port Number + + + + + + + Network Username: Network Password: Transcode: - Enable Performance Profiling - Local caching system Emby Network Device Name Advanced - Username - Port Number Number of recent Movies to show: Number of recent TV episodes to show: Number of recent Music Albums to show: @@ -141,7 +146,7 @@ Transcoding Server Detection Succeeded Found server - Address : + Address: Recently Added TV Shows @@ -175,7 +180,8 @@ Search Set Views - Select User + Select User + Profiling enabled. Please remember to turn off when finished testing. Error in ArtworkRotationThread @@ -262,6 +268,12 @@ Delete item from the server + Primary Server Address + Play from HTTP instead of SMB + Log level + Username + Port Number + Verify Host SSL Certificate Client SSL certificate Use alternate address @@ -299,7 +311,8 @@ Server messages Generate a new device Id Sync when screensaver is deactivated - Force Transcode Hi10P + Force Transcode Hi10P + Disabled Welcome @@ -337,4 +350,12 @@ Failed to generate a new device Id. See your logs for more information. A new device Id has been generated. Kodi will now restart. + Proceed with the following server? + Caution! If you choose Native mode, certain Emby features will be missing, such as: Emby cinema mode, direct stream/transcode options and parental access schedule. + Addon (Default) + Native (Direct Paths) + "Add network credentials to allow Kodi access to your content? Important: Kodi will need to be restarted to see the credentials. They can also be added at a later time. + Disable Emby music library? + Direct stream the music library? Select this option if the music library will be remotely accessed. + diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 4b1f63f3..da0a5108 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -25,15 +25,15 @@ class InitialSetup(): global log log = Logging(self.__class__.__name__).log - self.clientInfo = clientinfo.ClientInfo() - self.addonId = self.clientInfo.getAddonId() - self.doUtils = downloadutils.DownloadUtils() + self.addonId = clientinfo.ClientInfo().getAddonId() + self.doUtils = downloadutils.DownloadUtils().downloadUrl self.userClient = userclient.UserClient() def setup(self): # Check server, user, direct paths, music, direct stream if not direct path. addonId = self.addonId + dialog = xbmcgui.Dialog() ##### SERVER INFO ##### @@ -54,10 +54,10 @@ class InitialSetup(): xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId) return else: - server_confirm = xbmcgui.Dialog().yesno( - heading="Emby for Kodi", - line1="Proceed with the following server?", - line2="%s %s" % (lang(30169), server)) + server_confirm = dialog.yesno( + heading=lang(29999), + line1=lang(33034), + line2="%s %s" % (lang(30169), server)) if server_confirm: # Correct server found log("Server is selected. Saving the information.", 1) @@ -75,9 +75,8 @@ class InitialSetup(): ##### USER INFO ##### log("Getting user list.", 1) - - url = "%s/emby/Users/Public?format=json" % server - result = self.doUtils.downloadUrl(url, authenticate=False) + + result = self.doUtils("%s/emby/Users/Public?format=json" % server, authenticate=False) if result == "": log("Unable to connect to %s" % server, 1) return @@ -97,7 +96,7 @@ class InitialSetup(): users_hasPassword.append(name) log("Presenting user list: %s" % users_hasPassword, 1) - user_select = xbmcgui.Dialog().select(lang(30200), users_hasPassword) + user_select = dialog.select(lang(30200), users_hasPassword) if user_select > -1: selected_user = usernames[user_select] log("Selected user: %s" % selected_user, 1) @@ -105,38 +104,30 @@ class InitialSetup(): else: log("No user selected.", 1) xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId) + return ##### ADDITIONAL PROMPTS ##### - dialog = xbmcgui.Dialog() directPaths = dialog.yesno( - heading="Playback Mode", - line1=( - "Caution! If you choose Native mode, you " - "will lose access to certain Emby features such as: " - "Emby cinema mode, direct stream/transcode options, " - "parental access schedule."), - nolabel="Addon (Default)", - yeslabel="Native (Direct Paths)") + heading=lang(30511), + line1=lang(33035), + nolabel=lang(33036), + yeslabel=lang(33037)) if directPaths: log("User opted to use direct paths.", 1) settings('useDirectPaths', value="1") # ask for credentials credentials = dialog.yesno( - heading="Network credentials", - line1= ( - "Add network credentials to allow Kodi access to your " - "content? Note: Skipping this step may generate a message " - "during the initial scan of your content if Kodi can't " - "locate your content.")) + heading=lang(30517), + line1= lang(33038)) if credentials: log("Presenting network credentials dialog.", 1) passwordsXML() musicDisabled = dialog.yesno( - heading="Music Library", - line1="Disable Emby music library?") + heading=lang(29999), + line1=lang(33039)) if musicDisabled: log("User opted to disable Emby music library.", 1) settings('enableMusic', value="false") @@ -144,11 +135,8 @@ class InitialSetup(): # Only prompt if the user didn't select direct paths for videos if not directPaths: musicAccess = dialog.yesno( - heading="Music Library", - line1=( - "Direct stream the music library? Select " - "this option only if you plan on listening " - "to music outside of your network.")) + heading=lang(29999), + line1=lang(33040)) if musicAccess: log("User opted to direct stream music.", 1) settings('streamMusic', value="true") diff --git a/resources/settings.xml b/resources/settings.xml index 77d57a33..7ca31f61 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -33,7 +33,7 @@ - + diff --git a/service.py b/service.py index f47be05c..311e00a9 100644 --- a/service.py +++ b/service.py @@ -167,7 +167,7 @@ class Service(): else: add = "" xbmcgui.Dialog().notification( - heading="Emby for Kodi", + heading=lang(29999), message=("%s %s%s!" % (lang(33000), user.currUser.decode('utf-8'), add.decode('utf-8'))), @@ -242,7 +242,7 @@ class Service(): break # Alert the user that server is online. xbmcgui.Dialog().notification( - heading="Emby for Kodi", + heading=lang(29999), message=lang(33003), icon="special://home/addons/plugin.video.emby/icon.png", time=2000,