我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用xbmc.Keyboard()。
def Search(search_entered): favs = ADDON.getSetting('favs').split(',') if not search_entered: keyboard = xbmc.Keyboard('', 'Search iPlayer') keyboard.doModal() if keyboard.isConfirmed(): search_entered = keyboard.getText() search_entered = search_entered.replace(',', '') if len(search_entered) == 0: return if not search_entered in favs: favs.append(search_entered) ADDON.setSetting('favs', ','.join(favs)) NEW_URL ='http://vschedules.uktv.co.uk/mobile/v2/search?q=%s&platform=ios&app_ver=4.1.0' % (search_entered.replace(' ','%20')) FindSearch(NEW_URL)
def Search(search_entered): favs = ADDON.getSetting('favs').split(',') if not search_entered: keyboard = xbmc.Keyboard('', 'Search iPlayer') keyboard.doModal() if keyboard.isConfirmed(): search_entered = keyboard.getText() search_entered = search_entered.replace(',', '') if len(search_entered) == 0: return if not search_entered in favs: favs.append(search_entered) ADDON.setSetting('favs', ','.join(favs)) search_entered = search_entered.replace(' ','%20') NEW_URL='http://www.bbc.co.uk/iplayer/search?q=%s' % search_entered NextPageGenre(NEW_URL)
def _login_form(self): login_window = xbmc.Keyboard() login_window.setHeading(self._string(400500)) login_window.setHiddenInput(False) login_window.setDefault(_addon.getSetting(_USERNAME)) login_window.doModal() if login_window.isConfirmed(): username = login_window.getText() password_window = xbmc.Keyboard() password_window.setHeading(self._string(400501)) password_window.setHiddenInput(True) password_window.doModal() if password_window.isConfirmed(): return username, password_window.getText() else: raise Exception("Password input was cancelled.") else: raise Exception("Login input was cancelled.")
def search_type(field): last_field = addon.getSetting('last_search_field').decode('utf-8') search_text = addon.getSetting('last_search_text').decode('utf-8') if last_field <> field or not search_text: addon.setSetting('last_search_field', field) keyboard = xbmc.Keyboard('', _T(30206)) keyboard.doModal() if keyboard.isConfirmed(): search_text = keyboard.getText() else: search_text = '' addon.setSetting('last_search_text', search_text) if search_text: searchresults = session.search(field, search_text) add_items(searchresults.artists, content=CONTENT_FOR_TYPE.get('files'), end=False) add_items(searchresults.albums, end=False) add_items(searchresults.playlists, end=False) add_items(searchresults.tracks, end=False) add_items(searchresults.videos, end=True) else: #xbmcplugin.setContent(plugin.handle, content='files') xbmcplugin.endOfDirectory(plugin.handle, succeeded=False, updateListing=False)
def run_once(): global USERNAME, USERPASS while (Get('/') == None): user_keyboard = xbmc.Keyboard() user_keyboard.setHeading(__language__(30001)) user_keyboard.doModal() if (user_keyboard.isConfirmed()): USERNAME = user_keyboard.getText() pass_keyboard = xbmc.Keyboard() pass_keyboard.setHeading(__language__(30002)) pass_keyboard.setHiddenInput(True) pass_keyboard.doModal() if (pass_keyboard.isConfirmed()): USERPASS = pass_keyboard.getText() __settings__.setSetting('username', USERNAME) __settings__.setSetting('password', USERPASS) else: return False else: return False return True
def GetTrailerbyKeyboard(titulo,category,solo="false"): print "[trailertools.py] Modulo: GetTrailerbyKeyboard(titulo = %s , category = %s)" % (titulo,category) devuelve = [] keyboard = xbmc.Keyboard('default','heading') keyboard.setDefault(titulo) if titulo == "": keyboard.setHeading(config.get_localized_string(30112)) #"Introduce el Titulo a buscar" else: keyboard.setHeading(config.get_localized_string(30113)) #'Puedes recortar el titulo bien cambiar a otro idioma' keyboard.doModal() if (keyboard.isConfirmed()): tecleado = keyboard.getText() if len(tecleado)>0: devuelve = gettrailer(tecleado,category,solo) return devuelve else:return [] else:return []
def getUserInput(title=u"Input", default=u"", hidden=False): log("", 5) result = None # Fix for when this functions is called with default=None if not default: default = u"" keyboard = xbmc.Keyboard(default, title) keyboard.setHiddenInput(hidden) keyboard.doModal() if keyboard.isConfirmed(): result = keyboard.getText() log(repr(result), 5) return result # This function raises a keyboard numpad for user input
def on_keyboard_input(self, title, default='', hidden=False): # fallback for Frodo if self._context.get_system_version().get_version() <= (12, 3): keyboard = xbmc.Keyboard(default, title, hidden) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): text = utils.to_unicode(keyboard.getText()) return True, text else: return False, u'' # Starting with Gotham (13.X > ...) dialog = xbmcgui.Dialog() result = dialog.input(title, utils.to_unicode(default), type=xbmcgui.INPUT_ALPHANUM) if result: text = utils.to_unicode(result) return True, text return False, u''
def on_keyboard_input(self, title, default='', hidden=False): # fallback for Frodo if self._context.get_system_version().get_version() <= (12, 3): keyboard = xbmc.Keyboard(default, title, hidden) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): text = utils.to_unicode(keyboard.getText()) return True, text else: return False, u'' pass # Starting with Gotham (13.X > ...) dialog = xbmcgui.Dialog() result = dialog.input(title, utils.to_unicode(default), type=xbmcgui.INPUT_ALPHANUM) if result: text = utils.to_unicode(result) return True, text return False, u''
def _askLogin(self): user_keyboard = xbmc.Keyboard() user_keyboard.setHeading(__language__(30001)) user_keyboard.setHiddenInput(False) user_keyboard.setDefault(__settings__.getSetting('username')) user_keyboard.doModal() if user_keyboard.isConfirmed(): username = user_keyboard.getText() pass_keyboard = xbmc.Keyboard() pass_keyboard.setHeading(__language__(30002)) pass_keyboard.setHiddenInput(True) pass_keyboard.doModal() if pass_keyboard.isConfirmed(): return username, pass_keyboard.getText() else: raise Exception("Password input was cancelled.") else: raise Exception("Login input was cancelled.")
def search(params, parts, route): if "query" not in params: kb = xbmc.Keyboard() kb.doModal() if kb.isConfirmed(): return search(dict(query=kb.getText()), parts, route) else: return [] else: results = bc.get_search_results(params["query"]) # print results ret = [] for item in results: if type(item) is bc.Album: ret.append(album_to_listitem(item)) #if type(item) is bc.Track: # ret.append(track_to_listitem(item)) if type(item) is bc.Band: ret.append(band_to_listitem(item)) # results = [item for item in ret if item is not None] # print ret return ret
def SearchAndDeleteThumbnail(self): keyboard = xbmc.Keyboard() keyboard.doModal() query = keyboard.getText() if query: lists = []; query = query.replace("'", "''") match = RawXBMC.Execute("SELECT url FROM texture WHERE url LIKE '%" + query + "%'") for base in match: lists.append(base[0]) if len(lists) > 0: selected = xbmcgui.Dialog().multiselect(normalize(addonLanguage(32151)), lists) for sel in selected: url = str(lists[sel]) url = url.replace("'", "''") cachedUrl = RawXBMC.Execute("SELECT cachedurl FROM texture WHERE url='" + url + "'") cachedUrlPath = os.path.join(thumbnailsFolder, cachedUrl[0][0]) try: shutil.move(cachedUrlPath, thumbnailBackupFolder) except: pass RawXBMC.Execute("DELETE FROM texture WHERE url='" + url + "'") if showGUI: self.ShowStats() elif (addonSettings.getSetting("ShowNotifications") == "true"): xbmc.executebuiltin("Notification(%s,%s,2000,%s)" % (addonName, normalize(addonLanguage(32152)), addonIcon))
def add_track_to_playlist(self): xbmc.executebuiltin("ActivateWindow(busydialog)") if not self.trackid and xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)"): self.trackid = xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)") playlists = self.sp.user_playlists(self.userid, limit=50, offset=0) ownplaylists = [] ownplaylistnames = [] for playlist in playlists['items']: if playlist["owner"]["id"] == self.userid: ownplaylists.append(playlist) ownplaylistnames.append(playlist["name"]) ownplaylistnames.append(xbmc.getLocalizedString(525)) xbmc.executebuiltin("Dialog.Close(busydialog)") select = xbmcgui.Dialog().select(xbmc.getLocalizedString(524), ownplaylistnames) if select != -1 and ownplaylistnames[select] == xbmc.getLocalizedString(525): # create new playlist... kb = xbmc.Keyboard('', xbmc.getLocalizedString(21381)) kb.setHiddenInput(False) kb.doModal() if kb.isConfirmed(): name = kb.getText() playlist = self.sp.user_playlist_create(self.userid, name, False) self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid]) elif select != -1: playlist = ownplaylists[select] self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid])
def get_keyboard(heading, default=''): keyboard = xbmc.Keyboard() keyboard.setHeading(heading) if default: keyboard.setDefault(default) keyboard.doModal() if keyboard.isConfirmed(): return keyboard.getText() else: return None
def execute(self, data=''): # evaluate input argument and depends on run add-on event/action if data.startswith('Location'): keyboard = xbmc.Keyboard('', xbmc.getLocalizedString(14024), False) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText() != '': text = keyboard.getText() locationNames, locationIds = self.provider.location(text) dialog = xbmcgui.Dialog() if locationNames != []: selected = dialog.select(xbmc.getLocalizedString(396), locationNames) if selected != -1: commons.setSetting('Enabled', 'true') commons.setSetting(data, locationNames[selected]) commons.debug('Selected location: %s' % locationNames[selected]) commons.setSetting(data + 'id', locationIds[selected]) commons.debug('Selected location id: %s' % locationIds[selected]) else: dialog.ok(commons.AddonName(), commons.translate(284)) elif commons.setting('Enabled'): location = commons.setting('Location%s' % data) locationid = commons.setting('Location%sid' % data) if (locationid == '') and (data != '1'): location = commons.setting('Location1') locationid = commons.setting('Location1id') commons.debug('Trying first location instead: %s (%s)' % (location, locationid)) if locationid == '': commons.debug('Fallback to GeoIP') location, locationid = self.provider.geoip() if not locationid == '': commons.debug('Call forecast for location %s (%s)' % (location, locationid)) self.provider.forecast(location, locationid) else: commons.debug('No location found') self.provider.clear() self.provider.refresh() else: commons.debug('You need to enable weather retrieval in the weather underground add-on settings') self.provider.clear()
def keyboard_input(default_text="", title="", hidden=False): _log("keyboard_input default_text='"+default_text+"'") keyboard = xbmc.Keyboard(default_text,title,hidden) keyboard.doModal() if (keyboard.isConfirmed()): tecleado = keyboard.getText() else: tecleado = "" _log("keyboard_input ->'"+tecleado+"'") return tecleado
def getusersearch(website): kb = xbmc.Keyboard('default', 'heading') kb.setDefault('Enter Search Word') kb.setHeading(website + 'Search') kb.setHiddenInput(False) kb.doModal() if (kb.isConfirmed()): search_term = kb.getText() return(search_term) else: return
def getusersearch(language): kb = xbmc.Keyboard('default', 'heading') kb.setDefault('Enter Search Word') kb.setHeading(language + 'Search') kb.setHiddenInput(False) kb.doModal() if (kb.isConfirmed()): search_term = kb.getText() return(search_term) else: return
def EmailPass(): if ADDON.getSetting('email_pass_1')=='': search_entered = '' keyboard = xbmc.Keyboard(search_entered, 'Please Enter Email Password') keyboard.setHiddenInput(True) keyboard.doModal() if keyboard.isConfirmed(): THEPASS = keyboard.getText() if dialog.yesno("USB BACKUP/RESTORE", "Do you Want To Save Your Password ?", 'Its Fully AES Encrypted','Just Enter Secret 4 Digit Number'): EncryptPass(THEPASS) return THEPASS else: return DecryptPass()
def search_entered(): favs = ADDON.getSetting('favs').split(',') keyboard = xbmc.Keyboard('', 'Email') keyboard.doModal() if keyboard.isConfirmed(): search_entered = keyboard.getText() if not search_entered in favs: favs.append(search_entered) ADDON.setSetting('favs', ','.join(favs)) return search_entered
def _video_search(self): page = int(self.root.params['page']) q = self.root.params['q'] if q == 'none': s_win = xbmc.Keyboard() s_win.setHeading(self.root.gui._string(400515)) s_win.setHiddenInput(False) s_win.doModal() if s_win.isConfirmed(): q = s_win.getText() else: self.root.gui.notify(self.root.gui._string(400525), '') return else: q = pickle.loads(binascii.unhexlify(q)) history = get_search_history(_FILE_VIDEO_SEARCH_HISTORY) try: del history[history.index(q)] except ValueError: pass history = [q] + history put_search_history(history, _FILE_VIDEO_SEARCH_HISTORY) query_hex = binascii.hexlify(pickle.dumps(q, -1)) kwargs = { 'page': page, 'sort': _SETTINGS_VIDEO_SEARCH_SORT, 'hd' : _SETTINGS_VIDEO_SEARCH_HD, 'adult': _SETTINGS_VIDEO_SEARCH_ADULT, 'q': q, 'extended': 1 } search_res = media_entries('video.search', self.root.conn, _NO_OWNER, **kwargs) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) self.__create_video_list_(search_res) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) xbmcplugin.endOfDirectory(_addon_id)
def _group_search(self): page = int(self.root.params['page']) q = self.root.params['q'] if q == 'none': s_win = xbmc.Keyboard() s_win.setHeading(self._string(400515)) s_win.setHiddenInput(False) s_win.doModal() if s_win.isConfirmed(): q = s_win.getText() else: self.notify(self._string(400525), '') return else: q = pickle.loads(binascii.unhexlify(q)) history = get_search_history(_FILE_GROUP_SEARCH_HISTORY) try: del history[history.index(q)] except ValueError: pass history = [q] + history put_search_history(history, _FILE_GROUP_SEARCH_HISTORY) query_hex = binascii.hexlify(pickle.dumps(q, -1)) kwargs = { 'page': page, 'q': q } u = User(self.root.u.id, self.root.conn) search_res = u.group_search(**kwargs) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) self.__create_group_list_(search_res) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) xbmcplugin.endOfDirectory(_addon_id)
def _user_search(self): page = int(self.root.params['page']) q = self.root.params['q'] if q == 'none': s_win = xbmc.Keyboard() s_win.setHeading(self.root.gui._string(400515)) s_win.setHiddenInput(False) s_win.doModal() if s_win.isConfirmed(): q = s_win.getText() else: self.notify(self._string(400525), '') return else: q = pickle.loads(binascii.unhexlify(q)) history = get_search_history(_FILE_USER_SEARCH_HISTORY) try: del history[history.index(q)] except ValueError: pass history = [q] + history put_search_history(history, _FILE_USER_SEARCH_HISTORY) query_hex = binascii.hexlify(pickle.dumps(q, -1)) kwargs = { 'page': page, 'q': q } u = User(self.root.u.id, self.root.conn) search_res = u.user_search(**kwargs) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) self.__create_user_list_(search_res) if page < search_res['pages']: params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': page + 1} self.root.add_folder(self.root.gui._string(400602), params) xbmcplugin.endOfDirectory(_addon_id)
def keyboard(self, title, action): k = xbmc.Keyboard('', title); k.doModal() q = k.getText() if k.isConfirmed() else None if (q == None or q == ''): return q = urllib.quote_plus(q) url = '%s?action=%s&q=%s' % (sys.argv[0], action, q) control.execute('Container.Update(%s)' % url)
def inputText(self, title=None, text=None): """Grab search text from user.""" kbd = xbmc.Keyboard() if title: kbd.setHeading(title) if text: kbd.setDefault(text) kbd.doModal() if kbd.isConfirmed(): return kbd.getText()
def ShowKeyboard(): user_input = '' exit = True while exit: kb = xbmc.Keyboard('default', 'heading', True) kb.setDefault('') kb.setHeading('Authentication') kb.setHiddenInput(False) kb.doModal() if kb.isConfirmed(): user_input = kb.getText() exit = False return user_input
def dialog_input(default="", heading="", hidden=False): keyboard = xbmc.Keyboard(default, heading, hidden) keyboard.doModal() if keyboard.isConfirmed(): return keyboard.getText() else: return None
def input_keyword(): keyboard = Keyboard('', '???????') xbmc.sleep(1500) keyboard.doModal() if (keyboard.isConfirmed()): keyword = keyboard.getText() url = plugin.url_for("search_title", title=keyword) plugin.redirect(url)
def get_user_input(heading): keyboard = xbmc.Keyboard('', heading) keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() addon_log('User input string: %s' % query) else: query = None if query and len(query) > 0: return query else: return None
def SEARCH_DB(searchString=False): if not searchString: keyboard = xbmc.Keyboard('') keyboard.doModal() if (keyboard.isConfirmed()): searchString = keyboard.getText() if searchString != '': common.addText(' ----=== ' + common.getString(30104) + ' ===----') if not listmovie.LIST_MOVIES('movietitle', searchString, search=True): common.addText(common.getString(30202)) common.addText(' ----=== ' + common.getString(30107) + ' ===----') if not listtv.LIST_TVSHOWS('seriestitle', searchString, search=True): common.addText(common.getString(30202)) common.SetView('tvshows')
def dologin(): email = addon.getSetting('login_name') password = decode(addon.getSetting('login_pass')) changed = False if addon.getSetting('save_login') == 'false' or email == '' or password == '': keyboard = xbmc.Keyboard(addon.getSetting('login_name'), getString(30002)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): email = keyboard.getText() password = setLoginPW() if password: changed = True if password: if os.path.isfile(COOKIEFILE): os.remove(COOKIEFILE) cj = cookielib.LWPCookieJar() br = mechanize.Browser() br.set_handle_robots(False) br.set_cookiejar(cj) # br.set_debug_http(True) # br.set_debug_responses(True) br.addheaders = [('User-agent', UserAgent)] br.open(BASE_URL + "/gp/aw/si.html") br.select_form(name="signIn") br["email"] = email br["password"] = password logged_in = br.submit() error_str = "message error" if error_str in logged_in.read(): Dialog.ok(getString(30200), getString(30201)) return False else: if addon.getSetting('save_login') == 'true' and changed: addon.setSetting('login_name', email) addon.setSetting('login_pass', encode(password)) if addon.getSetting('no_cookie') != 'true': cj.save(COOKIEFILE, ignore_discard=True, ignore_expires=True) gen_id() return cj return True
def setLoginPW(): keyboard = xbmc.Keyboard('', getString(30003), True) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): password = keyboard.getText() return password return False
def _get_keyboard(default="", heading="", hidden=False): # Start Ketboard Function keyboard = xbmc.Keyboard(default, heading, hidden) keyboard.doModal() if (keyboard.isConfirmed()): return unicode(keyboard.getText(), "utf-8") return default
def get_keyboard(default="", heading="", hidden=False): keyboard = xbmc.Keyboard(default, heading, hidden) keyboard.doModal() if keyboard.isConfirmed(): return unicode(keyboard.getText(), "utf-8") return default # ############# Backup ############################################
def addSubreddit(subreddit, name, type_): from utils import colored_subreddit from reddit import this_is_a_multireddit, format_multihub alreadyIn = False with open(subredditsFile, 'r') as fh: content = fh.readlines() if subreddit: for line in content: if line.lower()==subreddit.lower(): alreadyIn = True if not alreadyIn: with open(subredditsFile, 'a') as fh: fh.write(subreddit+'\n') get_subreddit_entry_info(subreddit) xbmc_notify(colored_subreddit(subreddit), translation(32019) ) else: #dialog = xbmcgui.Dialog() #ok = dialog.ok('Add subreddit', 'Add a subreddit (videos)','or Multiple subreddits (music+listentothis)','or Multireddit (/user/.../m/video)') #would be great to have some sort of help to show first time user here keyboard = xbmc.Keyboard('', translation(32001)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): subreddit = keyboard.getText() #cleanup user input. make sure /user/ and /m/ is lowercase if this_is_a_multireddit(subreddit): subreddit = format_multihub(subreddit) else: get_subreddit_entry_info(subreddit) for line in content: if line.lower()==subreddit.lower()+"\n": alreadyIn = True if not alreadyIn: with open(subredditsFile, 'a') as fh: fh.write(subreddit+'\n') xbmc.executebuiltin("Container.Refresh")
def editSubreddit(subreddit, name, type_): from reddit import this_is_a_multireddit, format_multihub log( 'editSubreddit ' + subreddit) with open(subredditsFile, 'r') as fh: content = fh.readlines() contentNew = "" keyboard = xbmc.Keyboard(subreddit, translation(32003)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): newsubreddit = keyboard.getText() #cleanup user input. make sure /user/ and /m/ is lowercase if this_is_a_multireddit(newsubreddit): newsubreddit = format_multihub(newsubreddit) else: get_subreddit_entry_info(newsubreddit) for line in content: if line.strip()==subreddit.strip() : #if matches the old subreddit, #log("adding: %s %s %s" %(line, subreddit, newsubreddit) ) contentNew+=newsubreddit+'\n' else: contentNew+=line with open(subredditsFile, 'w') as fh: fh.write(contentNew) xbmc.executebuiltin("Container.Refresh")
def searchReddits(url, subreddit, type_): from default import urlMain from main_listing import listSubReddit #reddit search only works with a single subreddit if subreddit: initial_search_string='restrict_sr=on&sort=relevance&t=all&q=' initial_url=urlMain+'/r/'+subreddit else: initial_search_string='sort=relevance&t=year&q=' initial_url=urlMain keyboard = xbmc.Keyboard(initial_search_string, translation(32073)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): search_string=keyboard.getText() if search_string: search_string=urllib.quote_plus(search_string,safe='&=') #only &= are used because they're in the initial_search_string # #this https://www.reddit.com/r/Art/.json?&nsfw:no+&limit=10 # #becomes https://www.reddit.com/r/Art/search.json?&nsfw:no+&limit=10&q=SEARCHTERM&restrict_sr=on&sort=relevance&t=all url = initial_url +"/search.json?" +search_string #+ '+' + nsfw # + sites_filter skip the sites filter listSubReddit(url, 'Search', "")
def _getKeyboardInput(self): keyboard = xbmc.Keyboard('', self._(32005)) keyboard.doModal() text = None if keyboard.isConfirmed() and keyboard.getText(): text = keyboard.getText() return text
def read_input(self, header): keyboard = xbmc.Keyboard('', '??? ???????', False) keyboard.doModal() if keyboard.isConfirmed(): return keyboard.getText()
def get_user_input(self, heading, hidden=False): keyboard = xbmc.Keyboard('', heading, hidden) keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() self.log('User input string: %s' % query) else: query = None if query and len(query) > 0: return query else: return None
def new_search(search_type): """ Creates a new search. Saves it to add-on settings :param search_type 'free' for free search, 'series' for searching series names :return: None """ keyboard = xbmc.Keyboard() keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText() != '': search_text = "{0}:{1}".format(search_type, keyboard.getText()) search(search_text, 0) xbmcplugin.endOfDirectory(_handle)
def add_favourites_folder(fav_folder): keyboard = xbmc.Keyboard() keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText() != '': folder_name = 'favFolder' + keyboard.getText() if favourite_folder_exists('favourites', folder_name): pass else: _addon.setSetting(folder_name, "") add_favourite('folder', '0', folder_name, fav_folder) xbmcplugin.endOfDirectory(_handle)
def Do_SEARCH(self): query = self.params.get("query") if not query: kb = xbmc.Keyboard() kb.setHiddenInput(False) kb.setHeading(self.locale["input"]) history = self.GetSearchHistory(self.histId) if history: kb.setDefault(history[0]) kb.doModal() if kb.isConfirmed(): query = kb.getText() self.params["query"] = query self.Search(query)
def keyboard(text): keyboard = xbmc.Keyboard("", text, False) keyboard.doModal() if keyboard.isConfirmed(): return keyboard.getText() return None