From 463514186d275675e95e2b58be60ebb7e1895343 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 23 Jun 2018 19:15:24 +0200 Subject: [PATCH] Fix decoding of sys.argv --- default.py | 15 +++++++++------ resources/lib/entrypoint.py | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/default.py b/default.py index 96ae547a..e25e0d94 100644 --- a/default.py +++ b/default.py @@ -11,6 +11,7 @@ from xbmcplugin import setResolvedUrl from resources.lib import entrypoint, utils, pickler, pkc_listitem, \ variables as v, loghandler +from resources.lib.watchdog.utils import unicode_paths ############################################################################### @@ -26,9 +27,11 @@ class Main(): # MAIN ENTRY POINT # @utils.profiling() def __init__(self): - log.debug('Full sys.argv received: %s' % argv) + log.debug('Full sys.argv received: %s', argv) # Parse parameters - params = dict(parse_qsl(argv[2][1:])) + path = unicode_paths.decode(argv[0]) + arguments = unicode_paths.decode(argv[2]) + params = dict(parse_qsl(arguments[1:])) mode = params.get('mode', '') itemid = params.get('id', '') @@ -121,15 +124,15 @@ class Main(): log.info('User requested fanarttv refresh') utils.plex_command('RUN_LIB_SCAN', 'fanart') - elif '/extrafanart' in argv[0]: - plexpath = argv[2][1:] + elif '/extrafanart' in path: + plexpath = arguments[1:] plexid = itemid entrypoint.extra_fanart(plexid, plexpath) entrypoint.get_video_files(plexid, plexpath) # Called by e.g. 3rd party plugin video extras - elif ('/Extras' in argv[0] or '/VideoFiles' in argv[0] or - '/Extras' in argv[2]): + elif ('/Extras' in path or '/VideoFiles' in path or + '/Extras' in arguments): plexId = itemid or None entrypoint.get_video_files(plexId, params) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 0d433727..fee48e8a 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -24,7 +24,7 @@ LOG = getLogger('PLEX.entrypoint') try: HANDLE = int(argv[1]) - ARGV_0 = argv[0] + ARGV_0 = path_ops.decode_path(argv[0]) except IndexError: pass ###############################################################################