From 65fde9088f053b1766af53b31b2a36704fde5814 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 8 Mar 2017 10:58:08 +0100 Subject: [PATCH] Code refactoring --- default.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/default.py b/default.py index f70813a1..2e67a255 100644 --- a/default.py +++ b/default.py @@ -58,12 +58,8 @@ class Main(): log.debug("Full sys.argv received: %s" % argv) # Parse parameters params = dict(parse_qsl(argv[2][1:])) - try: - mode = params['mode'] - itemid = params.get('id', '') - except: - mode = "" - itemid = '' + mode = params.get('mode', '') + itemid = params.get('id', '') if mode == 'play': self.play() @@ -89,10 +85,10 @@ class Main(): int(params['limit'])) 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': - entrypoint.browse_plex_folder(params.get('id')) + entrypoint.browse_plex_folder(itemid) elif mode == 'browseplex': entrypoint.BrowsePlexContent(itemid, @@ -163,14 +159,14 @@ class Main(): elif "/extrafanart" in argv[0]: plexpath = argv[2][1:] - plexid = params.get('id') + plexid = itemid entrypoint.getExtraFanArt(plexid, plexpath) entrypoint.getVideoFiles(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]): - plexId = params.get('id', None) + plexId = itemid or None entrypoint.getVideoFiles(plexId, params) else: