-
-
Save anxdpanic/e645441ddf2977164daadb4b4f0c0e5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xbmcgui | |
import youtube_resolver | |
play_item = None | |
streams = youtube_resolver.resolve('RtU_mdL2vBM') | |
if streams: | |
streams = [stream for stream in streams if (stream.get('container') == 'mpd' and stream.get('Live') is True)] | |
if streams: | |
stream = streams[0] | |
title = stream.get('meta', {}).get('video', {}).get('title', '') | |
thumbnail = stream.get('meta', {}).get('images', {}).get('high', '') | |
stream_url = stream.get('url', '') | |
stream_headers = stream.get('headers', '') | |
if stream_headers: | |
stream_url += '|' + stream_headers | |
play_item = xbmcgui.ListItem(label=title, path=stream_url) | |
play_item.setArt({'thumb': thumbnail}) | |
try: | |
play_item.setContentLookup(False) | |
except AttributeError: | |
pass # Kodi version < 16 | |
play_item.setMimeType('application/xml+dash') | |
play_item.setProperty('inputstreamaddon', 'inputstream.adaptive') | |
play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd') | |
if stream_headers: | |
play_item.setProperty('inputstream.adaptive.stream_headers', stream_headers) | |
if play_item: | |
""" | |
import sys | |
import xbmcplugin | |
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, play_item) | |
""" | |
""" | |
import xbmc | |
xbmc.Player().play(stream_url, play_item) | |
""" | |
""" | |
self.play(stream_url, play_item) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment