Beispiel #1
0
def list_tvshows(response):
    """ TV shows listing """
    import_tvdb()

    # Attach TVDB data to TMDB results
    items = []
    results = response['results']
    for tvdb_show, tmdb_show in execute(tmdb_to_tvdb, results, workers=10):
        if tvdb_show is not None:
            info = build_tvshow_info(tvdb_show, tmdb_show)
            items.append(make_tvshow_item(info))

    if xbmc.abortRequested:
        return

    # Paging
    if 'page' in response:
        page = response['page']
        args = caller_args()
        if page < response['total_pages']:
            args['page'] = str(page + 1)
            items.append({
                'label': _("Next >>"),
                'icon': get_icon_path("item_next"),
                'path': plugin.url_for(caller_name(), **args)
            })

    return items
Beispiel #2
0
def list_tvshows(response):
    """ TV shows listing """
    import_tvdb()
        
    # Attach TVDB data to TMDB results
    items = []
    results = response['results']
    for tvdb_show, tmdb_show in execute(tmdb_to_tvdb, results, workers=10):
        if tvdb_show is not None:
            items.append(make_tvshow_item(tvdb_show, tmdb_show))
    
    if xbmc.abortRequested:
        return

    # Paging
    if 'page' in response:
        page = response['page']
        args = caller_args()
        if page < response['total_pages']:
            args['page'] = str(page + 1)
            items.append({
                'label': _("Next >>"),
                'icon': get_icon_path("item_next"),
                'path': plugin.url_for(caller_name(), **args)
            })
    
    return items
Beispiel #3
0
def get_video_link(players, params, mode, use_simple=False):
    lister = Lister()
    # Extend parameters
    for lang, lang_params in params.items():
        for key, value in lang_params.items():
            if isinstance(value, basestring):
                params[lang][key + "_+"] = value.replace(" ", "+")
                params[lang][key + "_-"] = value.replace(" ", "-")
                params[lang][key + "_escaped"] = value.replace(" ", "%2520")
                params[lang][key + "_escaped+"] = value.replace(" ", "%252B")
    pDialog = None
    selection = None
    try:
        if len(players) > 1 and use_simple:
            index = dialogs.select(_("Play using..."), [player.title for player in players])
            if index == -1: return None
            players = [players[index]]
        resolve_f = lambda p : resolve_player(p, lister, params)
        if len(players) > 1:
            pool_size = plugin.get_setting(SETTING_POOL_SIZE, int)
            populator = lambda : execute(resolve_f, players, lister.stop_flag, pool_size)
            selection = dialogs.select_ext(_("Play using..."), populator, len(players))
        else:
            result = resolve_f(players[0])
            if result:
                title, links = result
                if len(links) == 1: selection = links[0]
                else:
                    index = dialogs.select(_("Play using..."), [x['label'] for x in links])
                    if index > -1: selection = links[index]
            else: dialogs.ok(_("Error"), _("%s not found") % _("Video"))
    finally: lister.stop()
    return selection
Beispiel #4
0
def tvdb_tv_search_term(term, page):
    """ Perform search of a specified <term>"""
    import_tvdb()
    search_results = tvdb.search(term, language=LANG)
    items = []
    load_full_tvshow = lambda tvshow : tvdb.get_show(tvshow['id'], full=True)
    for tvdb_show in execute(load_full_tvshow, search_results, workers=10):
        info = build_tvshow_info(tvdb_show)
        items.append(make_tvshow_item(info))
    if FORCE == True: plugin.set_view_mode(VIEW); return items
    else: return items
Beispiel #5
0
def get_video_link(players, params, mode, use_simple=False):
    lister = Lister()

    # Extend parameters
    for lang, lang_params in params.items():
        for key, value in lang_params.items():
            if isinstance(value, basestring):
                params[lang][key + "_+"] = value.replace(" ", "+")
                params[lang][key + "_-"] = value.replace(" ", "-")
                params[lang][key + "_escaped"] = value.replace(" ", "%2520")
                params[lang][key + "_escaped+"] = value.replace(" ", "%252B")

    pDialog = None
    selection = None
    try:
        if len(players) > 1 and use_simple:
            index = dialogs.select(_("Choose Your Channel..."),
                                   [player.title for player in players])
            if index == -1:
                return None
            players = [players[index]]

        resolve_f = lambda p: resolve_player(p, lister, params)

        if len(players) > 1:
            pDialog = xbmcgui.DialogProgress()
            pDialog.create('Meta', 'Working...')
            dialogs.wait_for_dialog("progressdialog", 5)
            pool_size = plugin.get_setting(SETTING_POOL_SIZE, converter=int)
            populator = lambda: execute(resolve_f, players, lister.stop_flag,
                                        pool_size)
            selection = dialogs.select_ext(_("Choose Your Channel..."),
                                           populator, len(players))

        else:
            result = resolve_f(players[0])
            if result:
                title, links = result
                if len(links) == 1:
                    selection = links[0]
                else:
                    index = dialogs.select(_("Choose Your Channel..."),
                                           [x['label'] for x in links])
                    if index > -1:
                        selection = links[index]
            else:
                dialogs.ok(_("Error"), _("Video not found :("))
    finally:
        lister.stop()

    return selection
Beispiel #6
0
def tv_search_term(term, page):
    """ Perform search of a specified <term>"""
#    import_tmdb()
#    result = tmdb.Search().tv(query=term, language=LANG, page=page)
#    return list_tvshows(result)

    import_tvdb()
    
    search_results = tvdb.search(term, language=LANG)

    items = []
    load_full_tvshow = lambda tvshow : tvdb.get_show(tvshow['id'], full=True)
    for tvdb_show in execute(load_full_tvshow, search_results, workers=10):
        items.append(make_tvshow_item(tvdb_show))
    
    return items
Beispiel #7
0
def tv_search_term(term, page):
    """ Perform search of a specified <term>"""
    #    import_tmdb()
    #    result = tmdb.Search().tv(query=term, language=LANG, page=page)
    #    return list_tvshows(result)

    import_tvdb()

    search_results = tvdb.search(term, language=LANG)

    items = []
    load_full_tvshow = lambda tvshow: tvdb.get_show(tvshow['id'], full=True)
    for tvdb_show in execute(load_full_tvshow, search_results, workers=10):
        info = build_tvshow_info(tvdb_show)
        items.append(make_tvshow_item(info))

    return items
Beispiel #8
0
def get_video_link(players, params, mode, use_simple=False):
    lister = Lister()
    
    pDialog = None
    selection = None
    try:
        if len(players) > 1 and use_simple:
            index = dialogs.select(_("Play with..."), [player.title for player in players])
            if index == -1:
                return None
            players = [players[index]]
            
        resolve_f = lambda p : resolve_player(p, lister, params)
        
        if len(players) > 1:
            pDialog = xbmcgui.DialogProgress()
            pDialog.create('Meta', 'Working...')
            dialogs.wait_for_dialog("progressdialog", 5)
            populator = lambda : execute(resolve_f, players, lister.stop_flag)
            selection = dialogs.select_ext(_("Play with..."), populator, len(players))
            
        else:
            result = resolve_f(players[0])
            if result:
                title, links = result
                if len(links) == 1:
                    selection = links[0]
                else:
                    index = dialogs.select(_("Play with..."), [x['label'] for x in links])
                    if index > -1:
                        selection = links[index]
            else:
                dialogs.ok(_("Error"), _("Video not found :("))
    finally:
        lister.stop()

    return selection