Fix live tv

For now, use transcode since direct play returns a 127.0.0.1 unusable address as the path.
This commit is contained in:
angelblue05 2018-11-15 02:55:33 -06:00
parent 883c1741bf
commit ad6aa7e448

View file

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