Пример #1
0
def check_iptv_link():
    if settings.getBool(key='enable_simple_iptv'):
        try:
            IPTV_SIMPLE = xbmcaddon.Addon(id="pvr.iptvsimple")

            if not IPTV_SIMPLE.getSetting("epgPath") == (
                    ADDON_PROFILE + "epg.xml") or not IPTV_SIMPLE.getSetting(
                        "m3uPath") == (ADDON_PROFILE + "playlist.m3u8"):
                settings.setBool(key='enable_simple_iptv', value=False)
            else:
                profile_settings = load_profile(profile_id=1)

                if IPTV_SIMPLE.getSetting(
                        "userAgent") != profile_settings['user_agent']:
                    IPTV_SIMPLE.setSetting("userAgent",
                                           profile_settings['user_agent'])
        except:
            pass
Пример #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
Пример #4
0
def _set_settings_iptv(**kwargs):
    _close()

    try:
        IPTV_SIMPLE_ADDON_ID = "pvr.iptvsimple"

        try:
            IPTV_SIMPLE = xbmcaddon.Addon(id=IPTV_SIMPLE_ADDON_ID)
        except:
            xbmc.executebuiltin(
                'InstallAddon({})'.format(IPTV_SIMPLE_ADDON_ID), True)

        if IPTV_SIMPLE.getSettingBool("epgCache") != True:
            IPTV_SIMPLE.setSettingBool("epgCache", True)

        if IPTV_SIMPLE.getSettingInt("epgPathType") != 0:
            IPTV_SIMPLE.setSettingInt("epgPathType", 0)

        if IPTV_SIMPLE.getSetting("epgPath") != ADDON_PROFILE + "epg.xml":
            IPTV_SIMPLE.setSetting("epgPath", ADDON_PROFILE + "epg.xml")

        if IPTV_SIMPLE.getSetting("epgTimeShift") != "0":
            IPTV_SIMPLE.setSetting("epgTimeShift", "0")

        if IPTV_SIMPLE.getSettingBool("epgTSOverride") != False:
            IPTV_SIMPLE.setSettingBool("epgTSOverride", False)

        if get_kodi_version() > 18:
            if IPTV_SIMPLE.getSettingInt("m3uRefreshMode") != 2:
                IPTV_SIMPLE.setSettingInt("m3uRefreshMode", 2)

            if IPTV_SIMPLE.getSettingInt("m3uRefreshIntervalMins") != 60:
                IPTV_SIMPLE.setSettingInt("m3uRefreshIntervalMins", 60)

            if IPTV_SIMPLE.getSettingInt("m3uRefreshHour") != 4:
                IPTV_SIMPLE.setSettingInt("m3uRefreshHour", 4)

            if IPTV_SIMPLE.getSettingBool("catchupEnabled") != True:
                IPTV_SIMPLE.setSettingBool("catchupEnabled", True)

            if IPTV_SIMPLE.getSetting(
                    "catchupQueryFormat"
            ) != 'plugin://' + ADDON_ID + '/?_=play_video&type=program&id={catchup-id}':
                IPTV_SIMPLE.setSetting(
                    "catchupQueryFormat", 'plugin://' + ADDON_ID +
                    '/?_=play_video&type=program&id={catchup-id}')

            if IPTV_SIMPLE.getSettingInt("catchupDays") != 7:
                IPTV_SIMPLE.setSettingInt("catchupDays", 7)

            if IPTV_SIMPLE.getSettingInt("allChannelsCatchupMode") != 1:
                IPTV_SIMPLE.setSettingInt("allChannelsCatchupMode", 1)

            if IPTV_SIMPLE.getSettingBool("catchupPlayEpgAsLive") != True:
                IPTV_SIMPLE.setSettingBool("catchupPlayEpgAsLive", True)

            if IPTV_SIMPLE.getSettingInt(
                    "catchupWatchEpgBeginBufferMins") != 5:
                IPTV_SIMPLE.setSettingInt("catchupWatchEpgBeginBufferMins", 5)

            if IPTV_SIMPLE.getSettingInt("catchupWatchEpgEndBufferMins") != 15:
                IPTV_SIMPLE.setSettingInt("catchupWatchEpgEndBufferMins", 15)

            if IPTV_SIMPLE.getSettingBool(
                    "catchupOnlyOnFinishedProgrammes") != True:
                IPTV_SIMPLE.setSettingBool("catchupOnlyOnFinishedProgrammes",
                                           True)

        if IPTV_SIMPLE.getSettingBool("m3uCache") != True:
            IPTV_SIMPLE.setSettingBool("m3uCache", True)

        if IPTV_SIMPLE.getSettingInt("m3uPathType") != 0:
            IPTV_SIMPLE.setSettingInt("m3uPathType", 0)

        if IPTV_SIMPLE.getSetting(
                "m3uPath") != ADDON_PROFILE + "playlist.m3u8":
            IPTV_SIMPLE.setSetting("m3uPath", ADDON_PROFILE + "playlist.m3u8")

        profile_settings = load_profile(profile_id=1)

        if IPTV_SIMPLE.getSetting(
                "userAgent") != profile_settings['user_agent']:
            IPTV_SIMPLE.setSetting("userAgent", profile_settings['user_agent'])

        xbmc.executeJSONRPC(
            '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}'
            .format(IPTV_SIMPLE_ADDON_ID))
        xbmc.sleep(2000)
        xbmc.executeJSONRPC(
            '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}'
            .format(IPTV_SIMPLE_ADDON_ID))

        settings.setBool('enable_simple_iptv', True)
        gui.notification(_.DONE_REBOOT)
    except:
        pass
Пример #5
0
def check_first():
    profile_settings = load_profile(profile_id=1)

    if not check_key(profile_settings, 'setup_complete'):
        if gui.yes_no(message=_.DISABLE_EROTICA) == False:
            settings.setBool(key='disableErotica', value=False)
        else:
            settings.setBool(key='disableErotica', value=True)

        if gui.yes_no(message=_.MINIMAL_CHANNELS) == False:
            settings.setBool(key='minimalChannels', value=False)
        else:
            settings.setBool(key='minimalChannels', value=True)

        if gui.yes_no(message=_.DISABLE_REGIONAL) == False:
            settings.setBool(key='disableRegionalChannels', value=False)
        else:
            settings.setBool(key='disableRegionalChannels', value=True)

        if PROVIDER_NAME == 'kpn':
            if gui.yes_no(message=_.HOME_CONNECTION) == True:
                settings.setBool(key='homeConnection', value=True)
            else:
                settings.setBool(key='homeConnection', value=False)

        profile_settings['setup_complete'] = 1
        save_profile(profile_id=1, profile=profile_settings)