Esempio n. 1
0
def list_plugins(category):
    if category == "other":
        plugins = xmanager.find_plugins(None)
        links = build_plugin_links(plugins)
    elif category and category != "all":
        # 某个分类的插件
        plugins = xmanager.find_plugins(category)
        links = build_plugin_links(plugins)
    else:
        # 所有插件
        links = build_inner_tools()
        links += build_plugin_links(xconfig.PLUGINS_DICT.values())
    return links
Esempio n. 2
0
def list_plugins(category):
    dirname = xconfig.PLUGINS_DIR
    if not os.path.isdir(dirname):
        return []

    if category == "other":
        plugins = xmanager.find_plugins(None)
        links = build_plugin_links(dirname, [p.fname for p in plugins])
    elif category and category != "all":
        # 某个分类的插件
        plugins = xmanager.find_plugins(category)
        links = build_plugin_links(dirname, [p.fname for p in plugins])
    else:
        # 所有插件
        recent_names = cacheutil.zrange("plugins.history", -MAX_HISTORY, -1)
        recent_names.reverse()
        plugins_list = os.listdir(dirname)
        plugins_list = set(plugins_list) - set(recent_names)
        links = build_inner_tools()
        links += build_plugin_links(dirname,
                                    recent_names + sorted(plugins_list))
    return links
Esempio n. 3
0
def list_plugins(category):
    dirname = xconfig.PLUGINS_DIR
    if not os.path.isdir(dirname):
        return []

    if category:
        plugins = xmanager.find_plugins(category)
        print(category, plugins)
        links = build_plugin_links(dirname, [p.fname for p in plugins])
    else:
        recent_names = cacheutil.zrange("plugins.history", -MAX_HISTORY, -1)
        recent_names.reverse()
        plugins_list = os.listdir(dirname)
        plugins_list = set(plugins_list) - set(recent_names)
        links = build_plugin_links(dirname,
                                   recent_names + sorted(plugins_list))
    return links