def lists_search_for_lists_term(term, page): lists, pages = trakt.search_for_list(term, page) page = int(page) pages = int(pages) items = [] for list in lists: if "list" in list: list_info = list["list"] else: continue name = list_info["name"] user = list_info["username"] slug = list_info["ids"]["slug"] total = list_info["item_count"] info = {} info['title'] = name if "description" in list_info: info["plot"] = list_info["description"] else: info["plot"] = _("No description available") if user != None and total != None and total != 0: items.append({ 'label': "{0} - {1} ({2})".format(to_utf8(name), to_utf8(user), total), 'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug), 'context_menu': [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug)) ), ( "{0} ({1})".format(_("Play"), _("Random").lower()), "RunPlugin({0})".format(plugin.url_for("lists_trakt_play_random", user=user, slug=slug)) ) ], 'info': info, 'icon': get_icon_path("traktlikedlists"), 'thumbnail': get_icon_path("traktlikedlists"), }) fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if pages > page: items.append({ 'label': _("Next page").format() + " >> (%s/%s)" % (page + 1, pages), 'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1), 'icon': get_icon_path("item_next"), 'thumbnail': get_icon_path("item_next"), }) if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW) else: return plugin.finish(items=items, sort_methods=SORT)
def lists_search_for_lists_term(term,page): lists, pages = trakt.search_for_list(term, page) page = int(page) pages = int(pages) items = [] for list in lists: if "list" in list: list_info = list["list"] else: continue name = list_info["name"] user = list_info["username"] slug = list_info["ids"]["slug"] info = {} info['title'] = name if "description" in list_info: info["plot"] = list_info["description"] else: info["plot"] = _("No description available") if user != None: items.append({ 'label': "{0} {1} {2}".format(to_utf8(name), _("by"), to_utf8(user)), 'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug), 'context_menu': [ ( _("Add list to library"), "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_to_library", user=user, slug=slug)) ) ], 'info': info, 'icon': get_icon_path("traktlikedlists"), }) fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if (len(items) < plugin.get_setting(SETTING_TRAKT_PER_PAGE, int) and pages > page): page = page + 1 results = lists_search_for_lists_term(term, page) return items + results if pages > page: items.append({ 'label': _("Next page").format() + " >> (%s/%s)" % (page + 1, pages), 'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1), 'icon': get_icon_path("traktlikedlists"), }) if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW) else: return plugin.finish(items=items, sort_methods=SORT)
def lists_search_for_lists_term(term,page): lists, pages = trakt.search_for_list(term, page) page = int(page) pages = int(pages) items = [] for list in lists: if "list" in list: list_info = list["list"] else: continue name = list_info["name"] user = list_info["username"] slug = list_info["ids"]["slug"] info = {} info['title'] = name if "description" in list_info: info["plot"] = list_info["description"] else: info["plot"] = _("No description available") if user != None: items.append({ 'label': "{0} {1} {2}".format(name, _("by"), user), 'path': plugin.url_for("lists_trakt_show_list", user=user, slug=slug), 'info': info, 'icon': get_icon_path("traktlikedlists"), # TODO }) if (len(items) < 25 and pages > page): page = page + 1 results = lists_search_for_lists_term(term, page) return items + results if pages > page: items.append({ 'label': _("Next >>"), 'path': plugin.url_for("lists_search_for_lists_term", term = term, page=page + 1), 'icon': get_icon_path("traktlikedlists"), # TODO }) return items