Пример #1
0
def plugin_renew_token(data):
    from resources.lib.api import api_get_play_token

    api_get_play_token(locator=data['locator'], path=data['path'])

    data['path'] = data['path'].replace("/manifest.mpd", "/")

    splitpath = data['path'].split('/Manifest?device', 1)

    if len(splitpath) == 2:
        data['path'] = splitpath[0] + "/"

    return data['path']
Пример #2
0
def check_entitlements():
    from resources.lib.api import api_get_play_token

    profile_settings = load_profile(profile_id=1)

    v3 = int(profile_settings['v3'])

    if v3 == 0:
        media_groups_url = '{mediagroups_url}/lgi-nl-vod-myprime-movies?byHasCurrentVod=true&range=1-1&sort=playCount7%7Cdesc'.format(mediagroups_url=CONST_API_URLS[int(profile_settings['v3'])]['mediagroupsfeeds_url'])
    else:
        media_groups_url = '{mediagroups_url}/crid:~~2F~~2Fschange.com~~2Fdc30ecd3-4701-4993-993b-9ad4ff5fc301?byHasCurrentVod=true&range=1-1&sort=playCount7%7Cdesc'.format(mediagroups_url=CONST_API_URLS[int(profile_settings['v3'])]['mediagroupsfeeds_url'])

    download = api_download(url=media_groups_url, type='get', headers=None, data=None, json_data=False, return_json=True)
    data = download['data']
    code = download['code']

    if not code or not code == 200 or not data or not check_key(data, 'entryCount'):
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    id = data['mediaGroups'][0]['id']

    media_item_url = '{mediaitem_url}/{mediaitem_id}'.format(mediaitem_url=CONST_API_URLS[int(profile_settings['v3'])]['mediaitems_url'], mediaitem_id=id)

    download = api_download(url=media_item_url, type='get', headers=None, data=None, json_data=False, return_json=True)
    data = download['data']
    code = download['code']

    if not code or not code == 200 or not data:
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    if check_key(data, 'videoStreams'):
        urldata = get_play_url(content=data['videoStreams'])

    if (not urldata or not check_key(urldata, 'play_url') or not check_key(urldata, 'locator') or urldata['play_url'] == 'http://Playout/using/Session/Service') and v3:
            urldata = {}

            playout_url = '{base_url}/playout/vod/{id}?abrType=BR-AVC-DASH'.format(base_url=CONST_API_URLS[int(profile_settings['v3'])]['base_url'], id=id)
            download = api_download(url=playout_url, type='get', headers=None, data=None, json_data=False, return_json=True)
            data = download['data']
            code = download['code']

            if not code or not code == 200 or not data or not check_key(data, 'url') or not check_key(data, 'contentLocator'):
                gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
                settings.setBool(key='showMoviesSeries', value=False)
                return

            urldata['play_url'] = data['url']
            urldata['locator'] = data['contentLocator']

    if not urldata or not check_key(urldata, 'play_url') or not check_key(urldata, 'locator'):
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    token = api_get_play_token(locator=urldata['locator'], path=urldata['play_url'], force=1)

    if not token or not len(token) > 0:
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    gui.ok(message=_.YES_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
    settings.setBool(key='showMoviesSeries', value=True)

    return
Пример #3
0
def check_entitlements():
    from resources.lib.api import api_get_play_token

    media_groups_url = '{mediagroups_url}/crid%3A~~2F~~2Fschange.com~~2F64e9e221-aebf-4620-b248-8681feada6e8?byHasCurrentVod=true&range=1-1&sort=playCount7%7Cdesc'.format(
        mediagroups_url=CONST_URLS['mediagroupsfeeds_url'])

    download = api_download(url=media_groups_url,
                            type='get',
                            headers=None,
                            data=None,
                            json_data=False,
                            return_json=True)
    data = download['data']
    code = download['code']

    if not code or not code == 200 or not data or not check_key(
            data, 'entryCount'):
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    id = data['mediaGroups'][0]['id']

    media_item_url = '{mediaitem_url}/{mediaitem_id}'.format(
        mediaitem_url=CONST_URLS['mediaitems_url'], mediaitem_id=id)

    download = api_download(url=media_item_url,
                            type='get',
                            headers=None,
                            data=None,
                            json_data=False,
                            return_json=True)
    data = download['data']
    code = download['code']

    if not code or not code == 200 or not data:
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    if check_key(data, 'videoStreams'):
        urldata = get_play_url(content=data['videoStreams'])

    if (not urldata or not check_key(urldata, 'play_url')
            or not check_key(urldata, 'locator')
            or urldata['play_url'] == 'http://Playout/using/Session/Service'):
        urldata = {}

        playout_url = '{base_url}/playout/vod/{id}?abrType=BR-AVC-DASH'.format(
            base_url=CONST_URLS['base_url'], id=id)
        download = api_download(url=playout_url,
                                type='get',
                                headers=None,
                                data=None,
                                json_data=False,
                                return_json=True)
        data = download['data']
        code = download['code']

        if not code or not code == 200 or not data or not check_key(
                data, 'url') or not check_key(data, 'contentLocator'):
            gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
            settings.setBool(key='showMoviesSeries', value=False)
            return

        urldata['play_url'] = data['url']
        urldata['locator'] = data['contentLocator']

    if not urldata or not check_key(urldata, 'play_url') or not check_key(
            urldata, 'locator'):
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    token = api_get_play_token(locator=urldata['locator'],
                               path=urldata['play_url'],
                               force=1)

    if not token or not len(token) > 0:
        gui.ok(message=_.NO_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
        settings.setBool(key='showMoviesSeries', value=False)
        return

    gui.ok(message=_.YES_MOVIES_SERIES, heading=_.CHECKED_ENTITLEMENTS)
    settings.setBool(key='showMoviesSeries', value=True)

    return