def show(show_id): folder = plugin.Folder() data = api.show(show_id) art = _get_art(data['images']) folder.title = data['title'] for season in data['seasons']: folder.add_item( label = _(L_SEASON_NUMBER, label=True, season_number=season['number']), art = art, is_folder = False, ) rows = season['episodes'] folder.add_items(_parse_rows(rows, art)) return folder
def home(): folder = plugin.Folder() if not plugin.logged_in: folder.add_item(label=_(L_LOGIN, bold=True), path=plugin.url_for(login)) folder.add_item(label=_(L_SERIES, bold=plugin.logged_in), path=plugin.url_for(all_series), cache_key=cache.key_for(all_series)) folder.add_item(label=_(L_MOVIES, bold=plugin.logged_in), path=plugin.url_for(movies), cache_key=cache.key_for(movies)) folder.add_item(label=_(L_KIDS, bold=plugin.logged_in), path=plugin.url_for(kids), cache_key=cache.key_for(kids)) folder.add_item(label=_(L_SEARCH, bold=plugin.logged_in), path=plugin.url_for(search), cache_key=cache.key_for(search)) if plugin.logged_in: folder.add_item(label=_(L_LOGOUT), path=plugin.url_for(logout)) folder.add_item(label=_(L_SETTINGS), path=plugin.url_for(plugin.ROUTE_SETTINGS)) return folder
def search(): query = gui.input(_(L_SEARCH), default=userdata.get('search', '')).strip() if not query: return userdata.set('search', query) @cache.cached(LIST_EXPIRY) def get_results(query): folder = plugin.Folder(title=_(L_SEARCH_FOR, query=query)) rows = api.search(query) folder.add_items(_parse_rows(rows)) if not folder.items: folder.add_item( label = _(L_NO_RESULTS, label=True), is_folder = False, ) return folder return get_results(query)
def kids(): folder = plugin.Folder(title=_(L_KIDS)) rows = api.kids() folder.add_items(_parse_rows(rows)) return folder
def movies(): folder = plugin.Folder(title=_(L_MOVIES)) rows = api.movies() folder.add_items(_parse_rows(rows)) return folder
def all_series(): folder = plugin.Folder(title=_(L_SERIES)) rows = api.all_series() folder.add_items(_parse_rows(rows)) return folder
def logout(): if not gui.yes_no(_(L_LOGOUT_YES_NO)): return api.logout() gui.refresh()
def shows(): folder = plugin.Folder(title=_(L_SHOWS)) rows = api.shows() folder.add_items(_parse_rows(rows)) return folder