예제 #1
0
def play(plugin, channel_id, showtime=None, srno=None):
    with open(EXTRA_CHANNELS, "r") as f:
        extra = json.load(f)
    if showtime is None and extra.get(str(channel_id)):
        if extra.get(str(channel_id)).get("ext"):
            return extra.get(str(channel_id)).get("ext")
        return PLAY_EX_URL + extra.get(str(channel_id)).get("data")

    rjson = {"channel_id": int(channel_id), "stream_type": "Seek"}
    if showtime and srno:
        rjson["showtime"] = showtime
        rjson["srno"] = srno
        rjson["stream_type"] = "Catchup"

    resp = urlquick.post(GET_CHANNEL_URL, json=rjson).json()
    return Listitem().from_dict(
        **{
            "label": plugin._title,
            "callback": resp.get("result", "") + "?" +
            urlencode(getTokenParams()),
            "properties": {
                "IsPlayable":
                True,
                "inputstream":
                "inputstream.adaptive",
                "inputstream.adaptive.stream_headers":
                "User-Agent=KAIOS",
                "inputstream.adaptive.manifest_type":
                "hls",
                "inputstream.adaptive.license_key":
                urlencode(getTokenParams()) + "|" + urlencode(getHeaders()) +
                "|R{SSM}|",
            }
        })
예제 #2
0
def play_ex(plugin, dt=None):
    is_helper = inputstreamhelper.Helper(dt.get("proto", "mpd"),
                                         drm=dt.get("drm"))
    if is_helper.check_inputstream():
        licenseUrl = dt.get("lUrl") and dt.get("lUrl").replace(
            "{HEADERS}", urlencode(getHeaders())).replace(
                "{TOKEN}", urlencode(getTokenParams()))
        art = {}
        if dt.get("default_logo"):
            art['thumb'] = art['icon'] = IMG_CATCHUP + \
                dt.get("default_logo")
        return Listitem().from_dict(
            **{
                "label": dt.get("label") or plugin._title,
                "art": art or None,
                "callback": dt.get("pUrl"),
                "properties": {
                    "IsPlayable": True,
                    "inputstream": is_helper.inputstream_addon,
                    "inputstream.adaptive.stream_headers": dt.get("hdrs"),
                    "inputstream.adaptive.manifest_type": dt.get(
                        "proto", "mpd"),
                    "inputstream.adaptive.license_type": dt.get("drm"),
                    "inputstream.adaptive.license_key": licenseUrl,
                }
            })