Esempio n. 1
0
def startup():
    directory = os.path.dirname(ADDON_PROFILE + os.sep + "images")

    try:
        if not os.path.exists(directory):
            os.makedirs(directory)
    except:
        pass

    directory = os.path.dirname(ADDON_PROFILE + os.sep + "cache")

    try:
        if not os.path.exists(directory):
            os.makedirs(directory)
    except:
        pass

    system, arch = get_system_arch()
    proxyserver_port = find_free_port()

    query = "UPDATE `vars` SET `arch`='{arch}', `system`='{system}', `test_running`=0, `proxyserver_port`={proxyserver_port} WHERE profile_id={profile_id}".format(arch=arch, system=system, proxyserver_port=proxyserver_port, profile_id=1)
    query_settings(query=query, return_result=False, return_insert=False, commit=True)

    hourly(type=0)
    daily()
    change_icon()

    update_prefs()

    hourly(type=2)
Esempio n. 2
0
def startup():
    system, arch = get_system_arch()
    settings.set(key="_system", value=system)
    settings.set(key="_arch", value=arch)

    settings.setInt(key='_proxyserver_port', value=find_free_port())

    hourly()
    daily()
    change_icon()

    if settings.getBool(key='enable_simple_iptv') == True:
        try:
            IPTV_SIMPLE = xbmcaddon.Addon(id="pvr.iptvsimple")

            if IPTV_SIMPLE.getSetting("epgPath") == (
                    ADDON_PROFILE +
                    "epg.xml") and IPTV_SIMPLE.getSetting("m3uPath") == (
                        ADDON_PROFILE + "playlist.m3u8"):
                user_agent = settings.get(key='_user_agent')

                if IPTV_SIMPLE.getSetting("userAgent") != user_agent:
                    IPTV_SIMPLE.setSetting("userAgent", 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))
        except:
            pass
Esempio n. 3
0
def _reset(**kwargs):
    if not gui.yes_no(_.PLUGIN_RESET_YES_NO):
        return

    _close()

    try:
        xbmc.executeJSONRPC(
            '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}'
            .format(ADDON_ID))
        proxyport = settings.getInt(key='_proxyserver_port')

        shutil.rmtree(ADDON_PROFILE)

        settings.setInt(key='_proxyserver_port', value=proxyport)

        system, arch = get_system_arch()
        settings.set(key="_system", value=system)
        settings.set(key="_arch", value=arch)

        download_files()
        update_settings()
        change_icon()

    except:
        pass

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

    gui.notification(_.PLUGIN_RESET_OK)
    signals.emit(signals.AFTER_RESET)
    gui.refresh()
Esempio n. 4
0
def startup():
    system, arch = get_system_arch()
    proxyserver_port = find_free_port()

    query = "UPDATE `vars` SET `arch`='{arch}', `system`='{system}', `test_running`=0, `proxyserver_port`={proxyserver_port} WHERE profile_id={profile_id}".format(arch=arch, system=system, proxyserver_port=proxyserver_port, profile_id=1)
    query_settings(query=query, return_result=False, return_insert=False, commit=True)

    hourly(type=0)
    daily()
    change_icon()

    update_prefs()

    hourly(type=2)
Esempio n. 5
0
def startup():
    settings.setBool(key='_test_running', value=False)
    system, arch = get_system_arch()
    settings.set(key="_system", value=system)
    settings.set(key="_arch", value=arch)

    settings.setInt(key='_proxyserver_port', value=find_free_port())

    channels = False

    if settings.getInt(key='_channels_age') < int(time.time() - 86400):
        channels = True

    api.new_session(force=False, retry=False, channels=channels)
    api.update_prefs()

    hourly(type=0)
    daily()
    change_icon()
    hourly(type=2)