Code refactoring

This commit is contained in:
tomkat83 2017-03-08 10:58:08 +01:00
parent 2a48a71673
commit 65fde9088f

View file

@ -58,12 +58,8 @@ class Main():
log.debug("Full sys.argv received: %s" % argv) log.debug("Full sys.argv received: %s" % argv)
# Parse parameters # Parse parameters
params = dict(parse_qsl(argv[2][1:])) params = dict(parse_qsl(argv[2][1:]))
try: mode = params.get('mode', '')
mode = params['mode'] itemid = params.get('id', '')
itemid = params.get('id', '')
except:
mode = ""
itemid = ''
if mode == 'play': if mode == 'play':
self.play() self.play()
@ -89,10 +85,10 @@ class Main():
int(params['limit'])) int(params['limit']))
elif mode == 'Plex_Node': elif mode == 'Plex_Node':
entrypoint.Plex_Node(params.get('id'), params.get('viewOffset')) entrypoint.Plex_Node(itemid, params.get('viewOffset'))
elif mode == 'browse_plex_folder': elif mode == 'browse_plex_folder':
entrypoint.browse_plex_folder(params.get('id')) entrypoint.browse_plex_folder(itemid)
elif mode == 'browseplex': elif mode == 'browseplex':
entrypoint.BrowsePlexContent(itemid, entrypoint.BrowsePlexContent(itemid,
@ -163,14 +159,14 @@ class Main():
elif "/extrafanart" in argv[0]: elif "/extrafanart" in argv[0]:
plexpath = argv[2][1:] plexpath = argv[2][1:]
plexid = params.get('id') plexid = itemid
entrypoint.getExtraFanArt(plexid, plexpath) entrypoint.getExtraFanArt(plexid, plexpath)
entrypoint.getVideoFiles(plexid, plexpath) entrypoint.getVideoFiles(plexid, plexpath)
# Called by e.g. 3rd party plugin video extras # Called by e.g. 3rd party plugin video extras
elif ("/Extras" in argv[0] or "/VideoFiles" in argv[0] or elif ("/Extras" in argv[0] or "/VideoFiles" in argv[0] or
"/Extras" in argv[2]): "/Extras" in argv[2]):
plexId = params.get('id', None) plexId = itemid or None
entrypoint.getVideoFiles(plexId, params) entrypoint.getVideoFiles(plexId, params)
else: else: