예제 #1
0
def global_search():
    xbmcplugin.setPluginCategory(HANDLE, 'Search')
    xbmcplugin.setContent(HANDLE, 'movies')
    url = build_url({'mode': 'doglobalsearch'})
    xbmcplugin.addDirectoryItem(
        HANDLE, url,
        xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" %
                         "Enter search text ..."), True)

    # Support to save search history
    contents = XbmcHelper.search_history_get()
    if contents:
        url = build_url({'mode': 'clearsearch'})
        xbmcplugin.addDirectoryItem(
            HANDLE, url,
            xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" %
                             "Clear search text ..."), False)
        for txt in contents:
            try:
                url = build_url({'mode': 'doglobalsearch', 'url': txt})
                xbmcplugin.addDirectoryItem(
                    HANDLE, url,
                    xbmcgui.ListItem(label="[COLOR blue][B]%s[/B][/COLOR]" %
                                     txt), True)
            except:
                pass
    xbmcplugin.endOfDirectory(HANDLE)
예제 #2
0
def search(module, classname):
    xbmcplugin.setPluginCategory(HANDLE, 'Search')
    xbmcplugin.setContent(HANDLE, 'movies')
    url = build_url({'mode': 'dosearch', 'module': module, 'class': classname})
    xbmcplugin.addDirectoryItem(HANDLE,
                                url,
                                xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" % "Nhập tên phim tìm kiếm ..."),
                                True)

    # Support to save search history
    contents = XbmcHelper.search_history_get()
    if contents:
        url = build_url({'mode': 'clearsearch', 'module': module, 'class': classname})
        xbmcplugin.addDirectoryItem(HANDLE,
                                    url,
                                    xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" % "Xóa văn bản tìm kiếm ..."),
                                    True)
        for txt in contents:
            url = build_url({'mode': 'dosearch', 'module': module, 'class': classname, 'url': txt})
            xbmcplugin.addDirectoryItem(HANDLE,
                                        url,
                                        xbmcgui.ListItem(
                                            label="[COLOR blue][B]%s[/B][/COLOR]" % txt),
                                        True)
    xbmcplugin.endOfDirectory(HANDLE)
예제 #3
0
def global_search():
    xbmcplugin.setPluginCategory(plugin.handle, 'Search All')

    xbmcplugin.addDirectoryItem(
        plugin.handle, plugin.url_for(searching_all),
        xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" %
                         "Enter search text ..."), True)

    # Support to save search history
    contents = helper.search_history_get()
    if contents:
        xbmcplugin.addDirectoryItem(
            plugin.handle, plugin.url_for(clear_search),
            xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" %
                             "Clear search text ..."), True)
        for txt in contents:
            xbmcplugin.addDirectoryItem(
                plugin.handle, plugin.url_for(searching_all, query=txt),
                xbmcgui.ListItem(label="[COLOR blue][B]%s[/B][/COLOR]" % txt),
                True)

    xbmcplugin.endOfDirectory(plugin.handle)
예제 #4
0
def search():
    query = json.loads(plugin.args['query'][0])
    instance, module, class_name = load_plugin(query)

    xbmcplugin.setPluginCategory(plugin.handle, 'Search')
    url = plugin.url_for(searching,
                         query=json.dumps({
                             'module': module,
                             'className': class_name
                         }))

    xbmcplugin.addDirectoryItem(
        plugin.handle, url,
        xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" %
                         "Enter search text ..."), True)

    # Support to save search history
    contents = helper.search_history_get()
    if contents:
        xbmcplugin.addDirectoryItem(
            plugin.handle, plugin.url_for(clear_search),
            xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" %
                             "Clear search text ..."), True)
        for txt in contents:
            try:
                url = plugin.url_for(searching,
                                     query=json.dumps({
                                         'module': module,
                                         'className': class_name,
                                         'text': txt
                                     }))
                xbmcplugin.addDirectoryItem(
                    plugin.handle, url,
                    xbmcgui.ListItem(label="[COLOR blue][B]%s[/B][/COLOR]" %
                                     txt), True)
            except:
                pass
    xbmcplugin.endOfDirectory(plugin.handle)