예제 #1
0
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
예제 #2
0
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
예제 #3
0
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)
예제 #4
0
def kids():
    folder = plugin.Folder(title=_(L_KIDS))
    rows = api.kids()
    folder.add_items(_parse_rows(rows))
    return folder
예제 #5
0
def movies():
    folder = plugin.Folder(title=_(L_MOVIES))
    rows = api.movies()
    folder.add_items(_parse_rows(rows))
    return folder
예제 #6
0
def all_series():
    folder = plugin.Folder(title=_(L_SERIES))
    rows = api.all_series()
    folder.add_items(_parse_rows(rows))
    return folder
예제 #7
0
def logout():
    if not gui.yes_no(_(L_LOGOUT_YES_NO)):
        return

    api.logout()
    gui.refresh()
예제 #8
0
def shows():
    folder = plugin.Folder(title=_(L_SHOWS))
    rows = api.shows()
    folder.add_items(_parse_rows(rows))
    return folder