Skip to content

Instantly share code, notes, and snippets.

@MrDini123
Created January 11, 2024 16:18
Show Gist options
  • Save MrDini123/8bd1cc01477f96b96246079fb1f4558c to your computer and use it in GitHub Desktop.
Save MrDini123/8bd1cc01477f96b96246079fb1f4558c to your computer and use it in GitHub Desktop.
import xbmcgui
import xbmcplugin
from sys import argv
from urllib.parse import parse_qsl
params = dict(parse_qsl(argv[2].replace("?", "")))
action = params.get("action")
list_item = xbmcgui.ListItem("Test")
list_item.setProperty("inputstream", "inputstream.adaptive")
list_item.setProperty("inputstream.adaptive.manifest_type", "hls")
list_item.setProperty(
"inputstream.adaptive.manifest_headers",
"User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36&Cheese=Yes",
)
list_item.setProperty(
"inputstream.adaptive.stream_headers",
"User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36&Cheese=Yes",
)
list_item.setContentLookup(False)
list_item.setMimeType("video/mp4")
list_item.setProperty("IsPlayable", "true")
if not action:
xbmcplugin.addDirectoryItem(
handle=int(argv[1]),
url="http://localhost:8082/test.m3u8",
listitem=list_item,
)
xbmcplugin.endOfDirectory(int(argv[1]))
elif action == "play":
xbmcplugin.setResolvedUrl(int(argv[1]), True, list_item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment