add debug logging, fail gracefully (#17)

looks good
This commit is contained in:
anxdpanic
2017-12-07 17:44:44 -05:00
committed by Shaun
parent 40316a4875
commit 0904e8388b
2 changed files with 10 additions and 3 deletions

View File

@@ -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":

View File

@@ -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<item_property>[^=]+?)=(?P<property_value>.+)', 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