platformcode: fix some warning and populate also manifest_headers

This commit is contained in:
ilmich
2024-03-11 12:26:46 +01:00
parent 1ca9c7031c
commit a9992b9ea6

View File

@@ -1107,7 +1107,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
# logger.error('Failed to resolve hostname, fallback to normal dns')
from core import support
# support.dbg()
if '|' not in mediaurl and item.referer != False and 'youtube' not in mediaurl:
if '|' not in mediaurl and item.referer != False and 'youtube' not in mediaurl and not 'mpd' in item.manifest and not 'hls' in item.manifest:
mediaurl = mediaurl + '|' + urllib.urlencode(headers)
# video information is obtained.
@@ -1126,15 +1126,17 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
xlistitem.setMimeType('application/dash+xml')
xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent())
xlistitem.setProperty('inputstream.adaptive.stream_headers', urllib.urlencode(headers))
xlistitem.setProperty('inputstream.adaptive.manifest_headers', urllib.urlencode(headers))
elif hls or item.manifest == 'hls':# or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')):
if not install_inputstream():
return
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
xlistitem.setMimeType('application/x-mpegURL')
xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent())
xlistitem.setProperty('inputstream.adaptive.license_key', '|User-Agent='+httptools.get_user_agent() +'|')
xlistitem.setProperty('inputstream.adaptive.stream_headers', urllib.urlencode(headers))
xlistitem.setProperty('inputstream.adaptive.manifest_headers', urllib.urlencode(headers))
xlistitem.setProperty('inputstream.adaptive.license_key', '|' + urllib.urlencode(headers) +'|')
if force_direct: item.play_from = 'window'