From 0904e8388bd176bb45758b991d2da2fa85077b8a Mon Sep 17 00:00:00 2001 From: anxdpanic Date: Thu, 7 Dec 2017 17:44:44 -0500 Subject: [PATCH] add debug logging, fail gracefully (#17) looks good --- resources/lib/play_utils.py | 4 +++- resources/lib/utils.py | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/lib/play_utils.py b/resources/lib/play_utils.py index be89897..2e2fce6 100644 --- a/resources/lib/play_utils.py +++ b/resources/lib/play_utils.py @@ -91,11 +91,13 @@ def playFile(play_info): source = result['MediaSources'][0] if source.get('Container') == 'strm': playurl, listitem_props = PlayUtils().getStrmDetails(result) + if playurl is None: + return if not playurl: playurl, playback_type = PlayUtils().getPlayUrl(id, result, force_transcode, play_session_id) - log.debug("Play URL: " + playurl + " ListItem Properties: " + str(listitem_props)) + log.debug("Play URL: " + str(playurl) + " ListItem Properties: " + str(listitem_props)) playback_type_string = "DirectPlay" if playback_type == "2": diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 61b6bea..52eeb16 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -127,17 +127,22 @@ class PlayUtils(): lines = contents.split(line_break) for line in lines: line = line.strip() + log.debug("STRM Line: " + line) if line.startswith('#KODIPROP:'): match = re.search('#KODIPROP:(?P[^=]+?)=(?P.+)', line) if match: + log.debug("STRM property found: " + match.group('item_property') + " Value: " + match.group('property_value')) listitem_props.append((match.group('item_property'), match.group('property_value'))) + else: + log.debug("STRM #KODIPROP incorrect format") elif line.startswith('#'): # unrecognized, treat as comment - pass + log.debug("STRM unrecognized line identifier, ignored") elif line != '': playurl = line + log.debug("STRM playback url found") - log.debug("Playback URL: " + playurl + " ListItem Properties: " + str(listitem_props)) + log.debug("Playback URL: " + str(playurl) + " ListItem Properties: " + str(listitem_props)) return playurl, listitem_props