mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-20 08:15:09 +00:00
Strings
This commit is contained in:
parent
aa3a6fa17f
commit
a8fd73740c
5 changed files with 76 additions and 82 deletions
59
default.py
59
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)
|
Loading…
Add table
Add a link
Reference in a new issue