From ad6aa7e448f67874bf8f9532ecf9f3e5efa7acfe Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 15 Nov 2018 02:55:33 -0600 Subject: [PATCH 1/2] Fix live tv For now, use transcode since direct play returns a 127.0.0.1 unusable address as the path. --- resources/lib/helper/playutils.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/lib/helper/playutils.py b/resources/lib/helper/playutils.py index 829a62d4..eb8f491a 100644 --- a/resources/lib/helper/playutils.py +++ b/resources/lib/helper/playutils.py @@ -181,8 +181,13 @@ class PlayUtils(object): ''' self.info['MediaSourceId'] = source['Id'] - if source['RequiresOpening']: - source = self.live_stream(source) + if source.get('RequiresClosing'): + ''' Server is returning live tv stream with hardcoded 127.0.0.1. Skip over direct play/stream until fixed. + ''' + self.info['LiveStreamId'] = source['LiveStreamId'] + source['SupportsDirectPlay'] = False + source['SupportsDirectStream'] = False + source['Protocol'] = "LiveTV" if source.get('Protocol') == 'Http' or source['SupportsDirectPlay'] and (self.is_strm(source) or not settings('playFromStream.bool') and self.is_file_exists(source)): @@ -220,7 +225,7 @@ class PlayUtils(object): LOG.info(info) if info['MediaSource'].get('RequiresClosing'): - self.info['LiveStreamId'] = info['MediaSource']['LiveStreamId'] + self.info['LiveStreamId'] = source['LiveStreamId'] return info['MediaSource'] @@ -243,8 +248,9 @@ class PlayUtils(object): params = "%s%s" % ('&'.join(url_parsed), self.get_audio_subs(source, audio, subtitle)) - video_type = 'live' if source.get('LiveStreamId') else 'master' - self.info['Path'] = "%s/emby%s?%s" % (self.info['ServerAddress'], base.replace('stream', video_type), params) + video_type = 'live' if source['Protocol'] == 'LiveTV' else 'master' + base = base.replace('stream' if 'stream' in base else 'master', video_type, 1) + self.info['Path'] = "%s/emby%s?%s" % (self.info['ServerAddress'], base, params) self.info['Path'] += "&maxWidth=%s&maxHeight=%s" % (self.get_resolution()) else: self.info['Path'] = "%s/emby%s" % (self.info['ServerAddress'], source['TranscodingUrl']) @@ -421,7 +427,7 @@ class PlayUtils(object): ) if self.info['ForceTranscode']: - profile['DirectPlayProfiles'] = [{}] + profile['DirectPlayProfiles'] = [] if self.item['Type'] == 'TvChannel': profile['TranscodingProfiles'].insert(0, { @@ -436,6 +442,8 @@ class PlayUtils(object): "BreakOnNonKeyFrames": True }) + profile['DirectPlayProfiles'] = [] + return profile def set_external_subs(self, source, listitem): From 25ecdadad6195def7715736fcd485c19dcb95d88 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 15 Nov 2018 23:31:00 -0600 Subject: [PATCH 2/2] Allow live tv to direct stream --- resources/lib/helper/playutils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/lib/helper/playutils.py b/resources/lib/helper/playutils.py index eb8f491a..8d40370b 100644 --- a/resources/lib/helper/playutils.py +++ b/resources/lib/helper/playutils.py @@ -182,11 +182,11 @@ class PlayUtils(object): self.info['MediaSourceId'] = source['Id'] if source.get('RequiresClosing'): - ''' Server is returning live tv stream with hardcoded 127.0.0.1. Skip over direct play/stream until fixed. + + ''' Server is returning live tv stream for direct play is hardcoded with 127.0.0.1. ''' self.info['LiveStreamId'] = source['LiveStreamId'] source['SupportsDirectPlay'] = False - source['SupportsDirectStream'] = False source['Protocol'] = "LiveTV" if source.get('Protocol') == 'Http' or source['SupportsDirectPlay'] and (self.is_strm(source) or not settings('playFromStream.bool') and self.is_file_exists(source)): @@ -442,8 +442,6 @@ class PlayUtils(object): "BreakOnNonKeyFrames": True }) - profile['DirectPlayProfiles'] = [] - return profile def set_external_subs(self, source, listitem):