def search(): query = get_arg("q") offset = int(get_arg("offset", 0)) # remove saved search item if bool(get_arg("delete", False)): bcfs.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.get_string(32016)), {"new": True}) # [New Search] for item in bcfs.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xp.setPluginCategory(plugin.handle, ku.get_string(32007)) # Search xp.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() bcfs.append(query) if not query: return False search_url = bcfs.get_search_url(query=query) data = bcfs.get_html(search_url) xp.setPluginCategory( plugin.handle, "{} '{}'".format(ku.get_string(32007), bcfs.query_decode(query))) parse_results(data)
def search(): # type: () -> Union[bool, None] query = get_arg("q") # remove saved search item if bool(get_arg("delete", False)): eyes.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in eyes.searches.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False if eyes.SEARCH_SAVED: eyes.searches.append(query) category = "{} '{}'".format(ku.localize(32007), query) # Search 'query' xbmcplugin.setPluginCategory(plugin.handle, category) parse_results(eyes.get_search_url(query, 0), category) # first page is 0 xbmcplugin.endOfDirectory(plugin.handle)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q") category = get_arg("category", ku.localize(32007)) # Search total = get_arg("total") # Remove saved search item if bool(get_arg("delete", False)): pas.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), args={"new": True}) # [New Search] for item in pas.searches.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, args={"q": text, "category": "{} '{}'".format(ku.localize(32007), text)}) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle) return True # New look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False category = "{} '{}'".format(ku.localize(32007), query) if pas.SEARCH_SAVED: pas.searches.append(query) # Process search url = get_arg("href", pas.get_search_url(query=query)) soup = pas.get_html(url) count = int(total) if total else pas.text_to_int(soup.find("div", "results_count").text) parse_search_results(soup, url, count, category) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle)
def search(): query = get_arg("q") href = get_arg("href", False) # remove saved search item if bool(get_arg("delete", False)): jafc.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in jafc.retrieve(): text = item.encode("utf-8") add_menu_item( search, text, args={"q": text}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() jafc.append(query) if not query: return False url = jafc.get_url(href) if href else jafc.get_search_url(query) data = jafc.get_html(url) results = data.find("ul", "work-results") if not results: return paginate(data.find("ul", "pager-menu"), search) for item in results.find_all("li", "work-result"): action = item.find("a") img = item.find("img", "thumbnail") add_menu_item(play_film, item.find("h2").text, args={"href": action["href"]}, info=jafc.get_info(action["href"]), art=ku.art(jafc.get_url(img["src"])), directory=False) xbmcplugin.setPluginCategory(plugin.handle, "{} '{}'".format(ku.localize(32016), query)) xbmcplugin.endOfDirectory(plugin.handle)
def search(): query = get_arg("q") href = get_arg("href", False) # remove saved search item if bool(get_arg("delete", False)): jafc.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.get_string(32016)), {"new": True}) # [New Search] for item in jafc.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xp.setPluginCategory(plugin.handle, ku.get_string(32007)) # Search xp.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() jafc.append(query) if not query: return False url = jafc.get_page_url(href) if href else jafc.get_search_url(query) data = jafc.get_html(url) results = data.find("ul", "work-results") if not results: return paginate(data.find("ul", "pager-menu"), search) for item in results.find_all("li", "work-result"): action = item.find("a") img = item.find("img", "thumbnail") add_menu_item(play_film, item.find("h2").text, {"href": action["href"]}, info=get_info(action["href"]), art=ku.art(jafc.get_page_url(img["src"])), directory=False) xp.setPluginCategory(plugin.handle, "{} '{}'".format(ku.get_string(32016), query)) xp.endOfDirectory(plugin.handle)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q") category = get_arg("category", ku.localize(32007)) # Search # Remove saved search item if bool(get_arg("delete", False)): nfpfs.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), args={"new": True}) # [New Search] for item in nfpfs.searches.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, args={ "q": text, "category": "{} '{}'".format(ku.localize(32007), text) }) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle) return True # New look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False category = "{} '{}'".format(ku.localize(32007), query) if nfpfs.SEARCH_SAVED: nfpfs.searches.append(query) # Process search parse_search_results(nfpfs.get_json(nfpfs.NFPF_VIDEOS_URI), query) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q") offset = int(get_arg("offset", 0)) # remove saved search item if bool(get_arg("delete", False)): bfis.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), args={"new": True}) # [New Search] for item in bfis.searches.retrieve(): add_menu_item(search, item, args={"q": item}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False if bfis.SEARCH_SAVED: bfis.searches.append(query) # process results search_url = bfis.get_search_url(query, offset) data = bfis.get_json(search_url) parse_search_results(data, query, offset) xbmcplugin.setPluginCategory( plugin.handle, "{} '{}'".format(ku.localize(32007), bfis.query_decode(query))) xbmcplugin.setContent(plugin.handle, "videos") xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_DURATION) xbmcplugin.endOfDirectory(plugin.handle)
def search(): query = get_arg("q") page = int(get_arg("page", 1)) # remove saved search item if bool(get_arg("delete", False)): eafa.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.get_string(32016)), {"new": True}) # [New Search] for item in eafa.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xp.setPluginCategory(plugin.handle, ku.get_string(32007)) # Search xp.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() eafa.append(query) if not query: return False form = get_form_data(eafa.get_html(eafa.EAFA_SEARCH_URI)) if not form: return False data = eafa.post_html(eafa.EAFA_SEARCH_URI, { "__EVENTTARGET": "ctl00$ContentPlaceHolder1$ucSearch$ToolkitScriptManager1", "__EVENTARGUMENT": eafa.get_search_params(query, page), "__VIEWSTATE": form["state"] }) xp.setPluginCategory( plugin.handle, "{} '{}'".format(ku.get_string(32007), # Search 'query' eafa.query_decode(query)) ) parse_results(data, page, query)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q") href = get_arg("href", False) offset = int(get_arg("offset", 1)) category = get_arg("category", ku.localize(32007)) # Remove saved search item if bool(get_arg("delete", False)): mias.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in mias.searches.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # New look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False category = "{} '{}'".format(ku.localize(32007), query) if mias.SEARCH_SAVED: mias.searches.append(query) # Process search url = mias.get_search_url(query) if query else mias.update_offset( href, offset) logger.warning(url) soup = mias.get_html(url) parse_search_results(soup, url, category) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle)
def search(): # type: () -> Union[bool, None] query = get_arg("q") offset = int(get_arg("offset", 1)) period = get_arg("period", "") sound = "Sound" if ku.get_setting_as_bool("search_sound") else "" colour = "Colour" if ku.get_setting_as_bool("search_colour") else "" # remove saved search item if bool(get_arg("delete", False)): iwm.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in iwm.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() iwm.append(query) if not query: return False payload = iwm.IWM_SEARCH_PAYLOAD.copy() payload["keyword"] = query payload["page"] = offset payload["filter"] = 'Content_Date_Period,"{}",colourSorter,"{}",soundSorter,"{}",mediaType,"Video"'.format(period, colour, sound) title = period if period else query data = iwm.post_json(payload) xbmcplugin.setPluginCategory(plugin.handle, "{} '{}'".format(ku.localize(32007), title)) # Search 'query' parse_search_results(query, offset, data)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q", "+") page = get_arg("page", "1") category = get_arg("category", "{} '{}'".format(ku.localize(32007), query)) period = get_arg("period", "+-+") start, end = period.split("-") # remove saved search item if bool(get_arg("delete", False)): bps.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in bps.searches.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xbmcplugin.setPluginCategory(plugin.handle, ku.localize(32007)) # Search xbmcplugin.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False if bps.SEARCH_SAVED: bps.searches.append(query) # reset category on new search... category = "{} '{}'".format(ku.localize(32007), query) url = bps.get_search_url(query, start, end, page) soup = bps.get_html(url) paginate(soup, query, period) parse_search_results(soup) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle)
def search(): # type: () -> Optional[bool] """Search the archive""" query = get_arg("q") category = get_arg("category", ku.localize(32007)) # Search # Remove saved search item if bool(get_arg("delete", False)): locs.searches.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.localize(32016)), {"new": True}) # [New Search] for item in locs.searches.retrieve(): text = item.encode("utf-8") add_menu_item( search, text, { "q": text, "category": "{} '{}'".format(ku.localize(32007), text) }) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle) return True # New look-up if bool(get_arg("new", False)): query = ku.user_input() if not query: return False category = "{} '{}'".format(ku.localize(32007), query) if locs.SEARCH_SAVED: locs.searches.append(query) # Process search url = locs.get_search_url(query=query) data = locs.get_json(url) parse_search_results(data, category) xbmcplugin.setPluginCategory(plugin.handle, category) xbmcplugin.endOfDirectory(plugin.handle)
def search(): query = get_arg("q") offset = int(get_arg("offset", 0)) # remove saved search item if bool(get_arg("delete", False)): bfis.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.get_string(32016)), {"new": True}) # [New Search] for item in bfis.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xp.setPluginCategory(plugin.handle, ku.get_string(32007)) # Search xp.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() bfis.append(query) if not query: return False search_url = bfis.get_search_url(query, offset) data = bfis.get_json(search_url) if data is None: return False hits = data.get("hits", False) if not hits: return False # Results results = hits.get("hits", []) paginate(query, len(results), int(hits.get("total", 0)), offset) for element in results: data = element.get("_source", False) if not data: continue title = data.get("title", "") duration = data.get("duration", 0) # can still be NoneType * info = { "originaltitle": data.get("original_title", ""), "plot": bfis.html_to_text(data.get("standfirst", "")), "genre": data.get("genre", ""), "cast": data.get("cast", ""), "director": data.get("director", ""), "year": int(data.get("release_date", 0)), "duration": 0 if duration is None else int(duration) * 60, # * "mediatype": "video" } add_menu_item(play_film, title, {"href": data.get("url")}, ku.art(data.get("image", ["Default.png"])[0]), info, False) xp.setContent(plugin.handle, "videos") xp.setPluginCategory( plugin.handle, "{} '{}'".format(ku.get_string(32007), bfis.query_decode(query))) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_LABEL_IGNORE_THE) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_GENRE) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_VIDEO_YEAR) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_DURATION) xp.endOfDirectory(plugin.handle)
def search(): query = get_arg("q") offset = int(get_arg("offset", 0)) # remove saved search item if bool(get_arg("delete", False)): bfis.remove(query) xbmc.executebuiltin("Container.Refresh()") return True # View saved search menu if bool(get_arg("menu", False)): add_menu_item(search, "[{}]".format(ku.get_string(32016)), {"new": True}) # [New Search] for item in bfis.retrieve(): text = item.encode("utf-8") add_menu_item(search, text, {"q": text}) xp.setPluginCategory(plugin.handle, ku.get_string(32007)) # Search xp.endOfDirectory(plugin.handle) return True # look-up if bool(get_arg("new", False)): query = ku.user_input() bfis.append(query) if not query: return False search_url = bfis.get_search_url(query, offset) data = bfis.get_json(search_url) if data is None: return False hits = data.get("hits", False) if not hits: return False # Results results = hits.get("hits", []) paginate(query, len(results), int(hits.get("total", 0)), offset) for element in results: data = element.get("_source", False) if not data: continue title = data.get("title", "") duration = data.get("duration", 0) # can still be NoneType * info = { "originaltitle": data.get("original_title", ""), "plot": bfis.html_to_text(data.get("standfirst", "")), "genre": data.get("genre", ""), "cast": data.get("cast", ""), "director": data.get("director", ""), "year": int(data.get("release_date", 0)), "duration": 0 if duration is None else int(duration) * 60, # * "mediatype": "video" } add_menu_item( play_film, title, {"href": data.get("url")}, ku.art(data.get("image", ["Default.png"])[0]), info, False) xp.setContent(plugin.handle, "videos") xp.setPluginCategory(plugin.handle, "{} '{}'".format(ku.get_string(32007), bfis.query_decode(query))) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_LABEL_IGNORE_THE) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_GENRE) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_VIDEO_YEAR) xp.addSortMethod(plugin.handle, xp.SORT_METHOD_DURATION) xp.endOfDirectory(plugin.handle)