Strings - translation

This commit is contained in:
angelblue05 2016-06-20 20:57:29 -05:00
parent 924c3a4a05
commit 3e1aa94c78
10 changed files with 201 additions and 252 deletions

View file

@ -30,21 +30,19 @@ log = Logging('Entrypoint').log
#################################################################################################
def doPlayback(itemid, dbid):
def doPlayback(itemId, dbId):
emby = embyserver.Read_EmbyServer()
item = emby.getItem(itemid)
pbutils.PlaybackUtils(item).play(itemid, dbid)
item = emby.getItem(itemId)
pbutils.PlaybackUtils(item).play(itemId, dbId)
##### DO RESET AUTH #####
def resetAuth():
# User tried login and failed too many times
resp = xbmcgui.Dialog().yesno(
heading="Warning",
line1=(
"Emby might lock your account if you fail to log in too many times. "
"Proceed anyway?"))
if resp == 1:
heading=lang(30132),
line1=lang(33050))
if resp:
log("Reset login attempts.", 1)
window('emby_serverStatus', value="Auth")
else:
@ -58,6 +56,7 @@ def addDirectoryItem(label, path, folder=True):
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=folder)
def doMainListing():
xbmcplugin.setContent(int(sys.argv[1]), 'files')
# Get emby nodes from the window props
embyprops = window('Emby.nodes.total')
@ -68,39 +67,54 @@ def doMainListing():
if not path:
path = window('Emby.nodes.%s.content' % i)
label = window('Emby.nodes.%s.title' % i)
node_type = window('Emby.nodes.%s.type' % i)
#because we do not use seperate entrypoints for each content type, we need to figure out which items to show in each listing.
#for now we just only show picture nodes in the picture library video nodes in the video library and all nodes in any other window
if path and xbmc.getCondVisibility("Window.IsActive(Pictures)") and node_type == "photos":
addDirectoryItem(label, path)
elif path and xbmc.getCondVisibility("Window.IsActive(VideoLibrary)") and node_type != "photos":
addDirectoryItem(label, path)
elif path and not xbmc.getCondVisibility("Window.IsActive(VideoLibrary) | Window.IsActive(Pictures) | Window.IsActive(MusicLibrary)"):
addDirectoryItem(label, path)
node = window('Emby.nodes.%s.type' % i)
''' because we do not use seperate entrypoints for each content type,
we need to figure out which items to show in each listing.
for now we just only show picture nodes in the picture library
video nodes in the video library and all nodes in any other window '''
#experimental live tv nodes
addDirectoryItem("Live Tv Channels (experimental)", "plugin://plugin.video.emby/?mode=browsecontent&type=tvchannels&folderid=root")
addDirectoryItem("Live Tv Recordings (experimental)", "plugin://plugin.video.emby/?mode=browsecontent&type=recordings&folderid=root")
'''if path and xbmc.getCondVisibility("Window.IsActive(Pictures)") and node == "photos":
addDirectoryItem(label, path)
elif path and xbmc.getCondVisibility("Window.IsActive(VideoLibrary)")
and node != "photos":
addDirectoryItem(label, path)
elif path and not xbmc.getCondVisibility("Window.IsActive(VideoLibrary) |
Window.IsActive(Pictures) | Window.IsActive(MusicLibrary)"):
addDirectoryItem(label, path)'''
if path:
if xbmc.getCondVisibility("Window.IsActive(Pictures)") and node == "photos":
addDirectoryItem(label, path)
elif xbmc.getCondVisibility("Window.IsActive(VideoLibrary)") and node != "photos":
addDirectoryItem(label, path)
else:
addDirectoryItem(label, path)
# experimental live tv nodes
if not xbmc.getCondVisibility("Window.IsActive(Pictures)"):
addDirectoryItem(lang(33051),
"plugin://plugin.video.emby/?mode=browsecontent&type=tvchannels&folderid=root")
addDirectoryItem(lang(33052),
"plugin://plugin.video.emby/?mode=browsecontent&type=recordings&folderid=root")
# some extra entries for settings and stuff. TODO --> localize the labels
addDirectoryItem("Network credentials", "plugin://plugin.video.emby/?mode=passwords")
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings")
addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser")
addDirectoryItem("Refresh Emby playlists/nodes", "plugin://plugin.video.emby/?mode=refreshplaylist")
addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync")
addDirectoryItem("Repair local database (force update all content)", "plugin://plugin.video.emby/?mode=repair")
addDirectoryItem("Perform local database reset (full resync)", "plugin://plugin.video.emby/?mode=reset")
addDirectoryItem("Cache all images to Kodi texture cache", "plugin://plugin.video.emby/?mode=texturecache")
addDirectoryItem("Sync Emby Theme Media to Kodi", "plugin://plugin.video.emby/?mode=thememedia")
addDirectoryItem(lang(30517), "plugin://plugin.video.emby/?mode=passwords")
addDirectoryItem(lang(33053), "plugin://plugin.video.emby/?mode=settings")
addDirectoryItem(lang(33054), "plugin://plugin.video.emby/?mode=adduser")
addDirectoryItem(lang(33055), "plugin://plugin.video.emby/?mode=refreshplaylist")
addDirectoryItem(lang(33056), "plugin://plugin.video.emby/?mode=manualsync")
addDirectoryItem(lang(33057), "plugin://plugin.video.emby/?mode=repair")
addDirectoryItem(lang(33058), "plugin://plugin.video.emby/?mode=reset")
addDirectoryItem(lang(33059), "plugin://plugin.video.emby/?mode=texturecache")
addDirectoryItem(lang(33060), "plugin://plugin.video.emby/?mode=thememedia")
xbmcplugin.endOfDirectory(int(sys.argv[1]))
##### Generate a new deviceId
def resetDeviceId():
dialog = xbmcgui.Dialog()
language = utils.language
deviceId_old = window('emby_deviceId')
try:
@ -109,8 +123,8 @@ def resetDeviceId():
except Exception as e:
log("Failed to generate a new device Id: %s" % e, 1)
dialog.ok(
heading="Emby for Kodi",
line1=language(33032))
heading=lang(29999),
line1=lang(33032))
else:
log("Successfully removed old deviceId: %s New deviceId: %s" % (deviceId_old, deviceId), 1)
dialog.ok(
@ -123,21 +137,21 @@ def deleteItem():
# Serves as a keymap action
if xbmc.getInfoLabel('ListItem.Property(embyid)'): # If we already have the embyid
embyid = xbmc.getInfoLabel('ListItem.Property(embyid)')
itemId = xbmc.getInfoLabel('ListItem.Property(embyid)')
else:
dbid = xbmc.getInfoLabel('ListItem.DBID')
itemtype = xbmc.getInfoLabel('ListItem.DBTYPE')
dbId = xbmc.getInfoLabel('ListItem.DBID')
itemType = xbmc.getInfoLabel('ListItem.DBTYPE')
if not itemtype:
if not itemType:
if xbmc.getCondVisibility('Container.Content(albums)'):
itemtype = "album"
itemType = "album"
elif xbmc.getCondVisibility('Container.Content(artists)'):
itemtype = "artist"
itemType = "artist"
elif xbmc.getCondVisibility('Container.Content(songs)'):
itemtype = "song"
itemType = "song"
elif xbmc.getCondVisibility('Container.Content(pictures)'):
itemtype = "picture"
itemType = "picture"
else:
log("Unknown type, unable to proceed.", 1)
return
@ -145,7 +159,7 @@ def deleteItem():
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
item = emby_db.getItem_byKodiId(dbid, itemtype)
item = emby_db.getItem_byKodiId(dbId, itemType)
embycursor.close()
try:
@ -156,17 +170,13 @@ def deleteItem():
if settings('skipContextMenu') != "true":
resp = xbmcgui.Dialog().yesno(
heading="Confirm delete",
line1=("Delete file from Emby Server? This will "
"also delete the file(s) from disk!"))
heading=lang(29999),
line1=lang(33041))
if not resp:
log("User skipped deletion for: %s." % embyid, 1)
log("User skipped deletion for: %s." % itemId, 1)
return
doUtils = downloadutils.DownloadUtils()
url = "{server}/emby/Items/%s?format=json" % embyid
log("Deleting request: %s" % embyid, 0)
doUtils.downloadUrl(url, action_type="DELETE")
embyserver.Read_EmbyServer().deleteItem(itemId)
##### ADD ADDITIONAL USERS #####
def addUser():
@ -203,7 +213,7 @@ def addUser():
# Display dialog if there's additional users
if additionalUsers:
option = dialog.select("Add/Remove user from the session", ["Add user", "Remove user"])
option = dialog.select(lang(33061), [lang(33062), lang(33063)])
# Users currently in the session
additionalUserlist = {}
additionalUsername = []
@ -216,15 +226,15 @@ def addUser():
if option == 1:
# User selected Remove user
resp = dialog.select("Remove user from the session", additionalUsername)
resp = dialog.select(lang(33064), additionalUsername)
if resp > -1:
selected = additionalUsername[resp]
selected_userId = additionalUserlist[selected]
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
doUtils.downloadUrl(url, postBody={}, action_type="DELETE")
dialog.notification(
heading="Success!",
message="%s removed from viewing session" % selected,
heading=lang(29999),
message="%s %s" % (lang(33066), selected),
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000)
@ -256,16 +266,16 @@ def addUser():
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
doUtils.downloadUrl(url, postBody={}, action_type="POST")
dialog.notification(
heading="Success!",
message="%s added to viewing session" % selected,
heading=lang(29999),
message="%s %s" % (lang(33067), selected),
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000)
except:
log("Failed to add user to session.")
dialog.notification(
heading="Error",
message="Unable to add/remove user from the session.",
heading=lang(29999),
message=lang(33068),
icon=xbmcgui.NOTIFICATION_ERROR)
# Add additional user images
@ -297,7 +307,7 @@ def getThemeMedia():
playback = None
# Choose playback method
resp = dialog.select("Playback method for your themes", ["Direct Play", "Direct Stream"])
resp = dialog.select(lang(33072), [lang(30165), lang(33071)])
if resp == 0:
playback = "DirectPlay"
elif resp == 1:
@ -322,11 +332,7 @@ def getThemeMedia():
else:
# if it does not exist this will not work so warn user
# often they need to edit the settings first for it to be created.
dialog.ok(
heading="Warning",
line1=(
"The settings file does not exist in tvtunes. ",
"Go to the tvtunes addon and change a setting, then come back and re-run."))
dialog.ok(heading=lang(29999), line1=lang(33073))0
xbmc.executebuiltin('Addon.OpenSettings(script.tvtunes)')
return
@ -442,8 +448,8 @@ def getThemeMedia():
nfo_file.close()
dialog.notification(
heading="Emby for Kodi",
message="Themes added!",
heading=lang(29999),
message=lang(33069),
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000,
sound=False)
@ -461,8 +467,8 @@ def refreshPlaylist():
# Refresh views
lib.refreshViews()
dialog.notification(
heading="Emby for Kodi",
message="Emby playlists/nodes refreshed",
heading=lang(29999),
message=lang(33069),
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000,
sound=False)
@ -470,8 +476,8 @@ def refreshPlaylist():
except Exception as e:
log("Refresh playlists/nodes failed: %s" % e, 1)
dialog.notification(
heading="Emby for Kodi",
message="Emby playlists/nodes refresh failed",
heading=lang(29999),
message=lang(33070),
icon=xbmcgui.NOTIFICATION_ERROR,
time=1000,
sound=False)