def search(search_func, term = None): """ Search wrapper """ external = False if plugin.id == xbmc.getInfoLabel('Container.PluginName'): # Skip if search item isn't currently selected label = xbmc.getInfoLabel('ListItem.label') if label and not equals(label, _("Search")): return else: external = True if term is None: # Get search keyword search_entered = plugin.keyboard(heading=_("search for")) if not search_entered: return else: search_entered = term # Perform search url = plugin.url_for(search_func, term=search_entered, page='1') if external: xbmc.executebuiltin('ActivateWindow(10025,"plugin://%s/",return)' % plugin.id) xbmc.executebuiltin('Container.Update("%s")' % url) else: plugin.redirect(url)
def search(search_func, term=None): """ Search wrapper """ external = False if plugin.id == xbmc.getInfoLabel('Container.PluginName'): # Skip if search item isn't currently selected label = xbmc.getInfoLabel('ListItem.label') if label and not equals(label, _("Search")): return else: external = True if term is None: # Get search keyword search_entered = plugin.keyboard(heading=_("search for")) if not search_entered: return else: search_entered = term # Perform search url = plugin.url_for(search_func, term=search_entered, page='1') if external: xbmc.executebuiltin('ActivateWindow(10025,"plugin://%s/",return)' % plugin.id) xbmc.executebuiltin('Container.Update("%s")' % url) else: plugin.redirect(url)
def update_players_remote(url): # Get username and password parsed = urlparse(url) username = parsed.username password = parsed.password if username is not None: if not password: password = plugin.keyboard(heading=_('Enter password'), hidden=True) if not password: return False url = remove_auth(url) # Try without authentication response = None try: response = urllib2.urlopen(url) except urllib2.HTTPError, e: if not username: return False url = e.geturl()
def tvdb_tv_search(): """ Activate tv search """ term = plugin.keyboard(heading=_("search for")) return tvdb_tv_search_term(term, 1)
def music_search_track(): term = plugin.keyboard(heading=_("Enter search string")) return music_search_track_term(term, 1)
def root_search(): term = plugin.keyboard(heading=_("Enter search string")) if term != None and term != "": return root_search_term(term) else: return
def music_search_track(): term = plugin.keyboard(heading=_("search for")) return music_search_track_term(term, 1)
def music_search_edit(term): term = plugin.keyboard(default=term, heading=_("Enter search string")) if term != None and term != "": return music_search_term(term, 1) else: return
def music_search_album(): term = plugin.keyboard(heading=_("search for")) return music_search_album_term(term, 1)
def lists_trakt_search_for_lists(): term = plugin.keyboard(heading=_("Enter search string")) if term != None and term != "": return lists_search_for_lists_term(term, 1) else: return
def root_search_term(term, page): if term == "None": # Get search keyword search_entered = plugin.keyboard(heading=_("search for")) if not search_entered: return else: search_entered = term items = [ { "label": "All" + ": " + search_entered, "path": plugin.url_for(root_search_term, term=search_entered, page="1"), "icon": get_icon_path("search"), }, { "label": _("Movies") + " - " + _("Search (Trakt)") + ": " + search_entered, "path": plugin.url_for("trakt_movies_search_term", term=search_entered, page="1"), "icon": get_icon_path("movies"), }, { "label": _("Movies") + " - " + _("Search (TMDb)") + ": " + search_entered, "path": plugin.url_for("tmdb_movies_search_term", term=search_entered, page="1"), "icon": get_icon_path("movies"), }, { "label": _("TV shows") + " - " + _("Search (Trakt)") + ": " + search_entered, "path": plugin.url_for("trakt_tv_search_term", term=search_entered, page="1"), "icon": get_icon_path("tv"), }, { "label": _("TV shows") + " - " + _("Search (TMDb)") + ": " + search_entered, "path": plugin.url_for("tmdb_tv_search_term", term=search_entered, page="1"), "icon": get_icon_path("tv"), }, { "label": _("TV shows") + " - " + _("Search (TVDb)") + ": " + search_entered, "path": plugin.url_for("tvdb_tv_search_term", term=search_entered, page="1"), "icon": get_icon_path("tv"), }, { "label": _("Music") + " - " + _("Search artist") + ": " + search_entered, "path": plugin.url_for("music_search_artist_term", term=search_entered, page="1"), "icon": get_icon_path("music"), }, { "label": _("Music") + " - " + _("Search album") + ": " + search_entered, "path": plugin.url_for("music_search_album_term", term=search_entered, page="1"), "icon": get_icon_path("music"), }, { "label": _("Music") + " - " + _("Search track") + ": " + search_entered, "path": plugin.url_for("music_search_track_term", term=search_entered, page="1"), "icon": get_icon_path("music"), }, { "label": _("Live") + " - " + _("Search") + ": " + search_entered, "path": plugin.url_for("live_search_term", term=search_entered), "icon": get_icon_path("live"), }, { "label": _("Lists") + " - " + _("Search") + ": " + search_entered, "path": plugin.url_for("lists_search_for_lists_term", term=search_entered, page="1"), "icon": get_icon_path("lists"), }, ] fanart = plugin.addon.getAddonInfo("fanart") for item in items: item["properties"] = {"fanart_image": get_background_path()} return items
def tmdb_movies_search(): """ Activate movie search """ term = plugin.keyboard(heading=_("Enter search string")) if term != None and term != "": return tmdb_movies_search_term(term, 1) else: return
def trakt_movies_search(): term = plugin.keyboard(heading=_("Enter search string")) if term != None and term != "": return trakt_movies_search_term(term, 1) else: return
def trakt_movies_search(): term = plugin.keyboard(heading=_("search for")) return trakt_movies_search_term(term, 1)
def lists_trakt_search_for_lists(): term = plugin.keyboard(heading=_("search for")) return lists_search_for_lists_term(term, 1)
def live_search(): """ Activate channel search """ term = plugin.keyboard(heading=_("Enter search string")) return live_search_term(term)
def root_search_term(term, page): if term == "None": # Get search keyword search_entered = plugin.keyboard(heading=_("search for")) if not search_entered: return else: search_entered = term items = [{ 'label': "All" + ": " + search_entered, 'path': plugin.url_for(root_search_term, term=search_entered, page='1'), 'icon': get_icon_path("search"), }, { 'label': _("Movies") + " - " + _("Search (Trakt)") + ": " + search_entered, 'path': plugin.url_for("trakt_movies_search_term", term=search_entered, page='1'), 'icon': get_icon_path("movies"), }, { 'label': _("Movies") + " - " + _("Search (TMDb)") + ": " + search_entered, 'path': plugin.url_for("tmdb_movies_search_term", term=search_entered, page='1'), 'icon': get_icon_path("movies"), }, { 'label': _("TV shows") + " - " + _("Search (Trakt)") + ": " + search_entered, 'path': plugin.url_for("trakt_tv_search_term", term=search_entered, page='1'), 'icon': get_icon_path("tv"), }, { 'label': _("TV shows") + " - " + _("Search (TMDb)") + ": " + search_entered, 'path': plugin.url_for("tmdb_tv_search_term", term=search_entered, page='1'), 'icon': get_icon_path("tv"), }, { 'label': _("TV shows") + " - " + _("Search (TVDb)") + ": " + search_entered, 'path': plugin.url_for("tvdb_tv_search_term", term=search_entered, page='1'), 'icon': get_icon_path("tv"), }, { 'label': _("Music") + " - " + _("Search artist") + ": " + search_entered, 'path': plugin.url_for("music_search_artist_term", term=search_entered, page='1'), 'icon': get_icon_path("music"), }, { 'label': _("Music") + " - " + _("Search album") + ": " + search_entered, 'path': plugin.url_for("music_search_album_term", term=search_entered, page='1'), 'icon': get_icon_path("music"), }, { 'label': _("Music") + " - " + _("Search track") + ": " + search_entered, 'path': plugin.url_for("music_search_track_term", term=search_entered, page='1'), 'icon': get_icon_path("music"), }, { 'label': _("Live") + " - " + _("Search") + ": " + search_entered, 'path': plugin.url_for("live_search_term", term=search_entered), 'icon': get_icon_path("live"), }, { 'label': _("Lists") + " - " + _("Search") + ": " + search_entered, 'path': plugin.url_for("lists_search_for_lists_term", term=search_entered, page='1'), 'icon': get_icon_path("lists"), }] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image': get_background_path()} return items
def tmdb_movies_search(): """ Activate movie search """ term = plugin.keyboard(heading=_("search for")) return tmdb_movies_search_term(term, 1)
def trakt_tv_search(): term = plugin.keyboard(heading=_("search for")) return trakt_tv_search_term(term, 1)