mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Strings
This commit is contained in:
parent
aa3a6fa17f
commit
a8fd73740c
5 changed files with 76 additions and 82 deletions
55
default.py
55
default.py
|
@ -12,32 +12,32 @@ import xbmcgui
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
addon_ = xbmcaddon.Addon(id='plugin.video.emby')
|
_addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
addon_path = addon_.getAddonInfo('path').decode('utf-8')
|
_addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
||||||
base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
|
_base_resource = xbmc.translatePath(os.path.join(_addon_path, 'resources', 'lib')).decode('utf-8')
|
||||||
sys.path.append(base_resource)
|
sys.path.append(_base_resource)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
import entrypoint
|
import entrypoint
|
||||||
import utils
|
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
|
# MAIN ENTRY POINT
|
||||||
|
#@utils.profiling()
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
# Parse parameters
|
# Parse parameters
|
||||||
base_url = sys.argv[0]
|
base_url = sys.argv[0]
|
||||||
params = urlparse.parse_qs(sys.argv[2][1:])
|
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:
|
try:
|
||||||
mode = params['mode'][0]
|
mode = params['mode'][0]
|
||||||
itemid = params.get('id')
|
itemid = params.get('id')
|
||||||
|
@ -72,11 +72,13 @@ class Main:
|
||||||
embypath = sys.argv[2][1:]
|
embypath = sys.argv[2][1:]
|
||||||
embyid = params.get('id',[""])[0]
|
embyid = params.get('id',[""])[0]
|
||||||
entrypoint.getExtraFanArt(embyid,embypath)
|
entrypoint.getExtraFanArt(embyid,embypath)
|
||||||
|
return
|
||||||
|
|
||||||
if "/Extras" in sys.argv[0] or "/VideoFiles" in sys.argv[0]:
|
if "/Extras" in sys.argv[0] or "/VideoFiles" in sys.argv[0]:
|
||||||
embypath = sys.argv[2][1:]
|
embypath = sys.argv[2][1:]
|
||||||
embyid = params.get('id',[""])[0]
|
embyid = params.get('id',[""])[0]
|
||||||
entrypoint.getVideoFiles(embyid,embypath)
|
entrypoint.getVideoFiles(embyid, embypath)
|
||||||
|
return
|
||||||
|
|
||||||
if modes.get(mode):
|
if modes.get(mode):
|
||||||
# Simple functions
|
# Simple functions
|
||||||
|
@ -88,11 +90,11 @@ class Main:
|
||||||
limit = int(params['limit'][0])
|
limit = int(params['limit'][0])
|
||||||
modes[mode](itemid, limit)
|
modes[mode](itemid, limit)
|
||||||
|
|
||||||
elif mode in ["channels","getsubfolders"]:
|
elif mode in ("channels","getsubfolders"):
|
||||||
modes[mode](itemid)
|
modes[mode](itemid)
|
||||||
|
|
||||||
elif mode == "browsecontent":
|
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":
|
elif mode == "channelsfolder":
|
||||||
folderid = params['folderid'][0]
|
folderid = params['folderid'][0]
|
||||||
|
@ -104,12 +106,13 @@ class Main:
|
||||||
# Other functions
|
# Other functions
|
||||||
if mode == "settings":
|
if mode == "settings":
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||||
|
|
||||||
elif mode in ("manualsync", "fastsync", "repair"):
|
elif mode in ("manualsync", "fastsync", "repair"):
|
||||||
|
|
||||||
if window('emby_online') != "true":
|
if window('emby_online') != "true":
|
||||||
# Server is not online, do not run the sync
|
# Server is not online, do not run the sync
|
||||||
xbmcgui.Dialog().ok(heading="Emby for Kodi",
|
xbmcgui.Dialog().ok(heading=lang(29999),
|
||||||
line1=("Unable to run the sync, the add-on is not "
|
line1=lang(33034))
|
||||||
"connected to the Emby server."))
|
|
||||||
log("Not connected to the emby server.", 1)
|
log("Not connected to the emby server.", 1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -128,30 +131,12 @@ class Main:
|
||||||
elif mode == "texturecache":
|
elif mode == "texturecache":
|
||||||
import artwork
|
import artwork
|
||||||
artwork.Artwork().FullTextureCacheSync()
|
artwork.Artwork().FullTextureCacheSync()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
entrypoint.doMainListing()
|
entrypoint.doMainListing()
|
||||||
|
|
||||||
|
|
||||||
if ( __name__ == "__main__" ):
|
if __name__ == "__main__":
|
||||||
log('plugin.video.emby started', 1)
|
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)
|
log('plugin.video.emby stopped', 1)
|
|
@ -1,25 +1,30 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
<strings>
|
<strings>
|
||||||
|
|
||||||
<!-- Add-on settings -->
|
<!-- Add-on settings -->
|
||||||
|
<string id="29999">Emby for Kodi</string>
|
||||||
<string id="30000">Primary Server Address</string><!-- Verified -->
|
<string id="30000">Primary Server Address</string><!-- Verified -->
|
||||||
<string id="30002">Play from HTTP instead of SMB</string><!-- Verified -->
|
<string id="30002">Play from HTTP instead of SMB</string><!-- Verified -->
|
||||||
<string id="30004">Log level</string><!-- Verified -->
|
<string id="30004">Log level</string><!-- Verified -->
|
||||||
<string id="30005">Username: </string>
|
<string id="30024">Username</string><!-- Verified -->
|
||||||
<string id="30006">Password: </string>
|
<string id="30030">Port Number</string><!-- Verified -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Add-on settings -->
|
||||||
<string id="30007">Network Username: </string>
|
<string id="30007">Network Username: </string>
|
||||||
<string id="30008">Network Password: </string>
|
<string id="30008">Network Password: </string>
|
||||||
<string id="30009">Transcode: </string>
|
<string id="30009">Transcode: </string>
|
||||||
<string id="30010">Enable Performance Profiling</string>
|
|
||||||
<string id="30011">Local caching system</string>
|
|
||||||
|
|
||||||
<string id="30014">Emby</string>
|
<string id="30014">Emby</string>
|
||||||
<string id="30015">Network</string>
|
<string id="30015">Network</string>
|
||||||
<string id="30016">Device Name</string>
|
<string id="30016">Device Name</string>
|
||||||
|
|
||||||
<string id="30022">Advanced</string>
|
<string id="30022">Advanced</string>
|
||||||
<string id="30024">Username</string><!-- Verified -->
|
|
||||||
|
|
||||||
<string id="30030">Port Number</string><!-- Verified -->
|
|
||||||
<string id="30036">Number of recent Movies to show:</string>
|
<string id="30036">Number of recent Movies to show:</string>
|
||||||
<string id="30037">Number of recent TV episodes to show:</string>
|
<string id="30037">Number of recent TV episodes to show:</string>
|
||||||
<string id="30035">Number of recent Music Albums to show:</string>
|
<string id="30035">Number of recent Music Albums to show:</string>
|
||||||
|
@ -141,7 +146,7 @@
|
||||||
<string id="30166">Transcoding</string>
|
<string id="30166">Transcoding</string>
|
||||||
<string id="30167">Server Detection Succeeded</string>
|
<string id="30167">Server Detection Succeeded</string>
|
||||||
<string id="30168">Found server</string>
|
<string id="30168">Found server</string>
|
||||||
<string id="30169">Address : </string>
|
<string id="30169">Address:</string>
|
||||||
|
|
||||||
<!-- Video nodes -->
|
<!-- Video nodes -->
|
||||||
<string id="30170">Recently Added TV Shows</string><!-- Verified -->
|
<string id="30170">Recently Added TV Shows</string><!-- Verified -->
|
||||||
|
@ -175,7 +180,8 @@
|
||||||
<string id="30198">Search</string>
|
<string id="30198">Search</string>
|
||||||
<string id="30199">Set Views</string>
|
<string id="30199">Set Views</string>
|
||||||
|
|
||||||
<string id="30200">Select User</string>
|
<string id="30200">Select User</string><!-- Verified -->
|
||||||
|
|
||||||
<string id="30201">Profiling enabled.</string>
|
<string id="30201">Profiling enabled.</string>
|
||||||
<string id="30202">Please remember to turn off when finished testing.</string>
|
<string id="30202">Please remember to turn off when finished testing.</string>
|
||||||
<string id="30203">Error in ArtworkRotationThread</string>
|
<string id="30203">Error in ArtworkRotationThread</string>
|
||||||
|
@ -262,6 +268,12 @@
|
||||||
<string id="30409">Delete item from the server</string>
|
<string id="30409">Delete item from the server</string>
|
||||||
|
|
||||||
<!-- add-on settings -->
|
<!-- add-on settings -->
|
||||||
|
<string id="30000">Primary Server Address</string><!-- Verified -->
|
||||||
|
<string id="30002">Play from HTTP instead of SMB</string><!-- Verified -->
|
||||||
|
<string id="30004">Log level</string><!-- Verified -->
|
||||||
|
<string id="30024">Username</string><!-- Verified -->
|
||||||
|
<string id="30030">Port Number</string><!-- Verified -->
|
||||||
|
|
||||||
<string id="30500">Verify Host SSL Certificate</string>
|
<string id="30500">Verify Host SSL Certificate</string>
|
||||||
<string id="30501">Client SSL certificate</string>
|
<string id="30501">Client SSL certificate</string>
|
||||||
<string id="30502">Use alternate address</string>
|
<string id="30502">Use alternate address</string>
|
||||||
|
@ -300,6 +312,7 @@
|
||||||
<string id="30535">Generate a new device Id</string>
|
<string id="30535">Generate a new device Id</string>
|
||||||
<string id="30536">Sync when screensaver is deactivated</string>
|
<string id="30536">Sync when screensaver is deactivated</string>
|
||||||
<string id="30537">Force Transcode Hi10P</string>
|
<string id="30537">Force Transcode Hi10P</string>
|
||||||
|
<string id="30538">Disabled</string>
|
||||||
|
|
||||||
<!-- service add-on -->
|
<!-- service add-on -->
|
||||||
<string id="33000">Welcome</string>
|
<string id="33000">Welcome</string>
|
||||||
|
@ -337,4 +350,12 @@
|
||||||
<string id="33032">Failed to generate a new device Id. See your logs for more information.</string>
|
<string id="33032">Failed to generate a new device Id. See your logs for more information.</string>
|
||||||
<string id="33033">A new device Id has been generated. Kodi will now restart.</string>
|
<string id="33033">A new device Id has been generated. Kodi will now restart.</string>
|
||||||
|
|
||||||
|
<string id="33034">Proceed with the following server?</string>
|
||||||
|
<string id="33035">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.</string>
|
||||||
|
<string id="33036">Addon (Default)</string>
|
||||||
|
<string id="33037">Native (Direct Paths)</string>
|
||||||
|
<string id="33038">"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.</string>
|
||||||
|
<string id="33039">Disable Emby music library?</string>
|
||||||
|
<string id="33040">Direct stream the music library? Select this option if the music library will be remotely accessed.</string>
|
||||||
|
|
||||||
</strings>
|
</strings>
|
||||||
|
|
|
@ -25,15 +25,15 @@ class InitialSetup():
|
||||||
global log
|
global log
|
||||||
log = Logging(self.__class__.__name__).log
|
log = Logging(self.__class__.__name__).log
|
||||||
|
|
||||||
self.clientInfo = clientinfo.ClientInfo()
|
self.addonId = clientinfo.ClientInfo().getAddonId()
|
||||||
self.addonId = self.clientInfo.getAddonId()
|
self.doUtils = downloadutils.DownloadUtils().downloadUrl
|
||||||
self.doUtils = downloadutils.DownloadUtils()
|
|
||||||
self.userClient = userclient.UserClient()
|
self.userClient = userclient.UserClient()
|
||||||
|
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
# Check server, user, direct paths, music, direct stream if not direct path.
|
# Check server, user, direct paths, music, direct stream if not direct path.
|
||||||
addonId = self.addonId
|
addonId = self.addonId
|
||||||
|
dialog = xbmcgui.Dialog()
|
||||||
|
|
||||||
##### SERVER INFO #####
|
##### SERVER INFO #####
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ class InitialSetup():
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId)
|
xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
server_confirm = xbmcgui.Dialog().yesno(
|
server_confirm = dialog.yesno(
|
||||||
heading="Emby for Kodi",
|
heading=lang(29999),
|
||||||
line1="Proceed with the following server?",
|
line1=lang(33034),
|
||||||
line2="%s %s" % (lang(30169), server))
|
line2="%s %s" % (lang(30169), server))
|
||||||
if server_confirm:
|
if server_confirm:
|
||||||
# Correct server found
|
# Correct server found
|
||||||
|
@ -76,8 +76,7 @@ class InitialSetup():
|
||||||
|
|
||||||
log("Getting user list.", 1)
|
log("Getting user list.", 1)
|
||||||
|
|
||||||
url = "%s/emby/Users/Public?format=json" % server
|
result = self.doUtils("%s/emby/Users/Public?format=json" % server, authenticate=False)
|
||||||
result = self.doUtils.downloadUrl(url, authenticate=False)
|
|
||||||
if result == "":
|
if result == "":
|
||||||
log("Unable to connect to %s" % server, 1)
|
log("Unable to connect to %s" % server, 1)
|
||||||
return
|
return
|
||||||
|
@ -97,7 +96,7 @@ class InitialSetup():
|
||||||
users_hasPassword.append(name)
|
users_hasPassword.append(name)
|
||||||
|
|
||||||
log("Presenting user list: %s" % users_hasPassword, 1)
|
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:
|
if user_select > -1:
|
||||||
selected_user = usernames[user_select]
|
selected_user = usernames[user_select]
|
||||||
log("Selected user: %s" % selected_user, 1)
|
log("Selected user: %s" % selected_user, 1)
|
||||||
|
@ -105,38 +104,30 @@ class InitialSetup():
|
||||||
else:
|
else:
|
||||||
log("No user selected.", 1)
|
log("No user selected.", 1)
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId)
|
xbmc.executebuiltin('Addon.OpenSettings(%s)' % addonId)
|
||||||
|
return
|
||||||
|
|
||||||
##### ADDITIONAL PROMPTS #####
|
##### ADDITIONAL PROMPTS #####
|
||||||
dialog = xbmcgui.Dialog()
|
|
||||||
|
|
||||||
directPaths = dialog.yesno(
|
directPaths = dialog.yesno(
|
||||||
heading="Playback Mode",
|
heading=lang(30511),
|
||||||
line1=(
|
line1=lang(33035),
|
||||||
"Caution! If you choose Native mode, you "
|
nolabel=lang(33036),
|
||||||
"will lose access to certain Emby features such as: "
|
yeslabel=lang(33037))
|
||||||
"Emby cinema mode, direct stream/transcode options, "
|
|
||||||
"parental access schedule."),
|
|
||||||
nolabel="Addon (Default)",
|
|
||||||
yeslabel="Native (Direct Paths)")
|
|
||||||
if directPaths:
|
if directPaths:
|
||||||
log("User opted to use direct paths.", 1)
|
log("User opted to use direct paths.", 1)
|
||||||
settings('useDirectPaths', value="1")
|
settings('useDirectPaths', value="1")
|
||||||
|
|
||||||
# ask for credentials
|
# ask for credentials
|
||||||
credentials = dialog.yesno(
|
credentials = dialog.yesno(
|
||||||
heading="Network credentials",
|
heading=lang(30517),
|
||||||
line1= (
|
line1= lang(33038))
|
||||||
"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."))
|
|
||||||
if credentials:
|
if credentials:
|
||||||
log("Presenting network credentials dialog.", 1)
|
log("Presenting network credentials dialog.", 1)
|
||||||
passwordsXML()
|
passwordsXML()
|
||||||
|
|
||||||
musicDisabled = dialog.yesno(
|
musicDisabled = dialog.yesno(
|
||||||
heading="Music Library",
|
heading=lang(29999),
|
||||||
line1="Disable Emby music library?")
|
line1=lang(33039))
|
||||||
if musicDisabled:
|
if musicDisabled:
|
||||||
log("User opted to disable Emby music library.", 1)
|
log("User opted to disable Emby music library.", 1)
|
||||||
settings('enableMusic', value="false")
|
settings('enableMusic', value="false")
|
||||||
|
@ -144,11 +135,8 @@ class InitialSetup():
|
||||||
# Only prompt if the user didn't select direct paths for videos
|
# Only prompt if the user didn't select direct paths for videos
|
||||||
if not directPaths:
|
if not directPaths:
|
||||||
musicAccess = dialog.yesno(
|
musicAccess = dialog.yesno(
|
||||||
heading="Music Library",
|
heading=lang(29999),
|
||||||
line1=(
|
line1=lang(33040))
|
||||||
"Direct stream the music library? Select "
|
|
||||||
"this option only if you plan on listening "
|
|
||||||
"to music outside of your network."))
|
|
||||||
if musicAccess:
|
if musicAccess:
|
||||||
log("User opted to direct stream music.", 1)
|
log("User opted to direct stream music.", 1)
|
||||||
settings('streamMusic', value="true")
|
settings('streamMusic', value="true")
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="0" visible="eq(-1,true)" subsetting="true" />
|
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="0" visible="eq(-1,true)" subsetting="true" />
|
||||||
<setting id="syncEmptyShows" type="bool" label="30508" default="false" />
|
<setting id="syncEmptyShows" type="bool" label="30508" default="false" />
|
||||||
<setting id="dbSyncScreensaver" label="30536" type="bool" default="false" />
|
<setting id="dbSyncScreensaver" label="30536" type="bool" default="false" />
|
||||||
<setting id="useDirectPaths" type="enum" label="30511" values="Addon(Default)|Native(Direct paths)" default="0" />
|
<setting id="useDirectPaths" type="enum" label="30511" lvalues="33036|33037" default="0" />
|
||||||
<setting id="enableMusic" type="bool" label="30509" default="true" />
|
<setting id="enableMusic" type="bool" label="30509" default="true" />
|
||||||
<setting id="streamMusic" type="bool" label="30510" default="false" visible="eq(-1,true)" subsetting="true" />
|
<setting id="streamMusic" type="bool" label="30510" default="false" visible="eq(-1,true)" subsetting="true" />
|
||||||
<setting type="lsep" label="30523" />
|
<setting type="lsep" label="30523" />
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Service():
|
||||||
else:
|
else:
|
||||||
add = ""
|
add = ""
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
heading="Emby for Kodi",
|
heading=lang(29999),
|
||||||
message=("%s %s%s!"
|
message=("%s %s%s!"
|
||||||
% (lang(33000), user.currUser.decode('utf-8'),
|
% (lang(33000), user.currUser.decode('utf-8'),
|
||||||
add.decode('utf-8'))),
|
add.decode('utf-8'))),
|
||||||
|
@ -242,7 +242,7 @@ class Service():
|
||||||
break
|
break
|
||||||
# Alert the user that server is online.
|
# Alert the user that server is online.
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
heading="Emby for Kodi",
|
heading=lang(29999),
|
||||||
message=lang(33003),
|
message=lang(33003),
|
||||||
icon="special://home/addons/plugin.video.emby/icon.png",
|
icon="special://home/addons/plugin.video.emby/icon.png",
|
||||||
time=2000,
|
time=2000,
|
||||||
|
|
Loading…
Reference in a new issue