Fix LiveTV

This commit is contained in:
angelblue05 2018-11-16 03:42:36 -06:00
parent 883c1741bf
commit a90610e928
2 changed files with 14 additions and 7 deletions

View file

@ -312,7 +312,8 @@ def get_server_time():
def get_play_info(item_id, profile): def get_play_info(item_id, profile):
return items("/%s/PlaybackInfo" % item_id, "POST", json={ return items("/%s/PlaybackInfo" % item_id, "POST", json={
'UserId': "{UserId}", 'UserId': "{UserId}",
'DeviceProfile': profile 'DeviceProfile': profile,
'AutoOpenLiveStream': True
}) })
def get_live_stream(item_id, play_id, token, profile): def get_live_stream(item_id, play_id, token, profile):

View file

@ -181,8 +181,13 @@ class PlayUtils(object):
''' '''
self.info['MediaSourceId'] = source['Id'] self.info['MediaSourceId'] = source['Id']
if source['RequiresOpening']: if source.get('RequiresClosing'):
source = self.live_stream(source)
''' Server returning live tv stream for direct play is hardcoded with 127.0.0.1.
'''
self.info['LiveStreamId'] = source['LiveStreamId']
source['SupportsDirectPlay'] = 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)): 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) LOG.info(info)
if info['MediaSource'].get('RequiresClosing'): if info['MediaSource'].get('RequiresClosing'):
self.info['LiveStreamId'] = info['MediaSource']['LiveStreamId'] self.info['LiveStreamId'] = source['LiveStreamId']
return info['MediaSource'] return info['MediaSource']
@ -243,8 +248,9 @@ class PlayUtils(object):
params = "%s%s" % ('&'.join(url_parsed), self.get_audio_subs(source, audio, subtitle)) params = "%s%s" % ('&'.join(url_parsed), self.get_audio_subs(source, audio, subtitle))
video_type = 'live' if source.get('LiveStreamId') else 'master' video_type = 'live' if source['Protocol'] == 'LiveTV' else 'master'
self.info['Path'] = "%s/emby%s?%s" % (self.info['ServerAddress'], base.replace('stream', video_type), params) 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()) self.info['Path'] += "&maxWidth=%s&maxHeight=%s" % (self.get_resolution())
else: else:
self.info['Path'] = "%s/emby%s" % (self.info['ServerAddress'], source['TranscodingUrl']) self.info['Path'] = "%s/emby%s" % (self.info['ServerAddress'], source['TranscodingUrl'])
@ -421,7 +427,7 @@ class PlayUtils(object):
) )
if self.info['ForceTranscode']: if self.info['ForceTranscode']:
profile['DirectPlayProfiles'] = [{}] profile['DirectPlayProfiles'] = []
if self.item['Type'] == 'TvChannel': if self.item['Type'] == 'TvChannel':
profile['TranscodingProfiles'].insert(0, { profile['TranscodingProfiles'].insert(0, {