def youtube_search(query): properties = [ "dateadded", "file", "lastplayed", "plot", "title", "art", "playcount", "streamdetails", "director", "resume", "runtime", "plotoutline", "sorttitle", "cast", "votes", "trailer", "year", "country", "studio", "genre", "mpaa", "rating", "tagline", "writer", "originaltitle", "imdbnumber", "premiered", "episode", "showtitle", "firstaired", "watchedepisodes", "duration", "season" ] data = { "jsonrpc": "2.0", "method": "Files.GetDirectory", "id": 1, "params": { "properties": properties, "directory": "plugin://plugin.video.youtube/kodion/search/query/?q={0}".format( quote_plus(query)) } } json_response = xbmc.executeJSONRPC(json.dumps(data)) json_response = py2_decode(json_response) json_object = json.loads(json_response) result = [] if 'result' in json_object: for key, value in json_object['result'].items(): if not key == "limits" and (isinstance(value, list) or isinstance(value, dict)): result = value result = [i for i in result if not i["filetype"] == "directory"] return result
def search_categories(params): dialog = xbmcgui.Dialog() query = dialog.input(Language.search_categories) query = py2_decode(query) if not query: return url = build_url('categories', {'search': query}) list_categories(url)
def search_posts(params): dialog = xbmcgui.Dialog() query = dialog.input(Language.search_documentations) query = py2_decode(query) if not query: return url = build_url('posts', {'search': query}) list_videos(url)