Merge conflicts default.py

This commit is contained in:
tomkat83 2016-08-29 19:12:46 +02:00
parent 6aab9df054
commit 1ab8ede29a

View file

@ -12,26 +12,22 @@ import xbmcaddon
import xbmcgui 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.plexkodiconnect') _addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
try: try:
addon_path = _addon.getAddonInfo('path').decode('utf-8') _addon_path = _addon.getAddonInfo('path').decode('utf-8')
except TypeError: except TypeError:
addon_path = _addon.getAddonInfo('path').decode() _addon_path = _addon.getAddonInfo('path').decode()
try: try:
base_resource = xbmc.translatePath(os.path.join( _base_resource = xbmc.translatePath(os.path.join(
addon_path, _addon_path,
'resources', 'resources',
'lib')).decode('utf-8') 'lib')).decode('utf-8')
except TypeError: except TypeError:
base_resource = xbmc.translatePath(os.path.join( _base_resource = xbmc.translatePath(os.path.join(
addon_path, _addon_path,
'resources', 'resources',
'lib')).decode() 'lib')).decode()
sys.path.append(_base_resource)
############################################################################### ###############################################################################
@ -44,9 +40,9 @@ from utils import window, language as lang
import loghandler import loghandler
loghandler.config() loghandler.config()
log = logging.getLogger("EMBY.default") log = logging.getLogger("PLEX.default")
################################################################################################# ###############################################################################
class Main(): class Main():
@ -55,10 +51,9 @@ class Main():
#@utils.profiling() #@utils.profiling()
def __init__(self): def __init__(self):
# Parse parameters # Parse parameters
xbmc.log("PlexKodiConnect - Full sys.argv received: %s" % sys.argv) log.warn("Full sys.argv received: %s" % sys.argv)
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:])
log.warn("Parameter string: %s" % sys.argv[2])
try: try:
mode = params['mode'][0] mode = params['mode'][0]
itemid = params.get('id', '') itemid = params.get('id', '')
@ -104,7 +99,7 @@ class Main():
plexpath = sys.argv[2][1:] plexpath = sys.argv[2][1:]
plexid = params.get('id', [""])[0] plexid = params.get('id', [""])[0]
entrypoint.getExtraFanArt(plexid, plexpath) entrypoint.getExtraFanArt(plexid, plexpath)
entrypoint.getVideoFiles(embyid, embypath) entrypoint.getVideoFiles(plexid, plexpath)
return return
# Called by e.g. 3rd party plugin video extras # Called by e.g. 3rd party plugin video extras
@ -163,16 +158,15 @@ class Main():
"PlexKodiConnect", "PlexKodiConnect",
"Unable to run the sync, the add-on is not connected " "Unable to run the sync, the add-on is not connected "
"to a Plex server.") "to a Plex server.")
utils.logMsg("PLEX", log.error("Not connected to a PMS.")
"Not connected to a PMS.", -1)
return return
else: else:
if mode == 'repair': if mode == 'repair':
utils.window('plex_runLibScan', value="repair") utils.window('plex_runLibScan', value="repair")
utils.logMsg("PLEX", "Requesting repair lib sync", 1) log.warn("Requesting repair lib sync")
elif mode == 'manualsync': elif mode == 'manualsync':
utils.logMsg("PLEX", "Requesting full library scan", 1) log.warn("Requesting full library scan")
utils.window('plex_runLibScan', value="full") utils.window('plex_runLibScan', value="full")
elif mode == "texturecache": elif mode == "texturecache":
@ -182,32 +176,7 @@ class Main():
else: else:
entrypoint.doMainListing() entrypoint.doMainListing()
if ( __name__ == "__main__" ):
xbmc.log('plugin.video.plexkodiconnect started')
if enableProfiling:
import cProfile
import pstats
import random
from time import gmtime, strftime
addonid = utils.tryDecode(addon_.getAddonInfo('id'))
datapath = os.path.join(utils.tryDecode(xbmc.translatePath( "special://profile/" )), "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()
xbmc.log('plugin.video.plexkodiconnect stopped')
if __name__ == "__main__": if __name__ == "__main__":
log.info('plugin.video.emby started') log.info('plugin.video.plexkodiconnect started')
Main() Main()
log.info('plugin.video.emby stopped') log.info('plugin.video.plexkodiconnect stopped')