예제 #1
0
파일: router.py 프로젝트: dut-iptv/dut-iptv
def dispatch(url):
    with signals.throwable():
        function, params = parse_url(url)
        signals.emit(signals.BEFORE_DISPATCH)

        function(**params)

    signals.emit(signals.AFTER_DISPATCH)
예제 #2
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))

        profile_settings = load_profile(profile_id=1)
        proxyserver_port = int(profile_settings['proxyserver_port'])
        system = profile_settings['system']
        arch = profile_settings['arch']

        shutil.rmtree(ADDON_PROFILE)

        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

        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)

        download_files()
        update_settings()
        update_prefs()
    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()
예제 #3
0
파일: plugin.py 프로젝트: dut-iptv/dut-iptv
def _reset(**kwargs):
    if not gui.yes_no(_.PLUGIN_RESET_YES_NO):
        return

    _close()

    try:
        method = 'Addons.SetAddonEnabled'
        json_rpc(method, {"addonid": ADDON_ID, "enabled": "false"})

        remove_dir(directory="cache", ext=False)
        remove_dir(directory="tmp", ext=False)

        for file in glob.glob(os.path.join(ADDON_PROFILE, "stream*")):
            remove_file(file=file, ext=True)

        for file in glob.glob(os.path.join(ADDON_PROFILE, "*.json")):
            remove_file(file=file, ext=True)

        for file in glob.glob(os.path.join(ADDON_PROFILE, "*.xml")):
            remove_file(file=file, ext=True)

        if not os.path.isdir(os.path.join(ADDON_PROFILE, "cache")):
            os.makedirs(os.path.join(ADDON_PROFILE, "cache"))

        if not os.path.isdir(os.path.join(ADDON_PROFILE, "tmp")):
            os.makedirs(os.path.join(ADDON_PROFILE, "tmp"))

        if not os.path.isdir(os.path.join(ADDON_PROFILE, "movies")):
            os.makedirs(os.path.join(ADDON_PROFILE, "movies"))

        if not os.path.isdir(os.path.join(ADDON_PROFILE, "shows")):
            os.makedirs(os.path.join(ADDON_PROFILE, "shows"))
    except:
        pass

    method = 'Addons.SetAddonEnabled'
    json_rpc(method, {"addonid": ADDON_ID, "enabled": "true"})

    gui.notification(_.PLUGIN_RESET_OK)
    signals.emit(signals.AFTER_RESET)
    gui.refresh()
예제 #4
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))

        shutil.rmtree(ADDON_PROFILE)

        directory = os.path.dirname(ADDON_PROFILE + os.sep +
                                    "images/empty.jpg")

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

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

        try:
            if not os.path.exists(directory):
                os.makedirs(directory)
        except:
            pass
    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()
예제 #5
0
def _close():
    signals.emit(signals.ON_CLOSE)