def lists_trakt_add_liked_to_library(): lists, pages = trakt.trakt_get_liked_lists(1) misc_ids = [] movie_ids = [] tv_ids = [] import xbmcgui pDialog = xbmcgui.DialogProgress() pDialog.create('[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR]', 'Creating batch import files') for page in range(0, int(pages)): lists, ignore = trakt.trakt_get_liked_lists(page) list_number = 1 if (pDialog.iscanceled()): return percent = (int(page) / int(pages)) * 100 pDialog.update(int(percent), '{0} {1} of {2} ... '.format(_("Scanning for new content"), page, pages)) for list in lists: list_number += 1 pDialog.update(int(percent), '{0} {1} of {2} ... '.format(_("Scanning for new content"), page, pages), 'list {0} of {1} on page'.format(list_number, len(lists) + 1)) info = list["list"] user = info["user"]["username"] slug = info["ids"]["slug"] items = lists_trakt_show_list(user, slug) list_misc_ids, list_movie_ids, list_tv_ids = batch_find_list_ids(items) write_list_id_files(list_misc_ids, list_movie_ids, list_tv_ids, slug, user) misc_ids.extend(list_misc_ids) movie_ids.extend(list_movie_ids) tv_ids.extend(list_tv_ids) pDialog.close() write_batch_id_files(tv_ids, movie_ids, misc_ids) dialogs.notify(msg='Generating', title='.strm-files', delay=3000, image=get_icon_path("metalliq")) xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/movies/batch_add_to_library)")
def lists_trakt_liked_lists(page): lists, pages = trakt.trakt_get_liked_lists(page) items = [] for list in lists: info = list["list"] name = info["name"] user = info["user"]["username"] slug = info["ids"]["slug"] items.append({ 'label': name, '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)) ) ], 'icon': get_icon_path("traktlikedlists"), }) if pages > page: items.append({ 'label': _("Next >>"), 'path': plugin.url_for("lists_trakt_liked_lists", page = int(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_trakt_liked_lists(): lists = trakt.trakt_get_liked_lists() items = [] for list in lists: info = list["list"] name = info["name"] user = info["user"]["username"] slug = info["ids"]["slug"] items.append({ 'label': name, 'path': plugin.url_for("lists_trakt_show_list", user = user, slug = slug), 'icon': get_icon_path("tv"), # TODO }) return sorted(items,key = lambda item: item["label"])
def lists_trakt_liked_lists(page): lists, pages = trakt.trakt_get_liked_lists(page) items = [] for list in lists: info = list["list"] name = info["name"] user = info["user"]["username"] slug = info["ids"]["slug"] items.append({ 'label': name, 'path': plugin.url_for("lists_trakt_show_list", user = user, slug = slug), 'icon': get_icon_path("traktlikedlists"), # TODO }) if pages > page: items.append({ 'label': _("Next >>"), 'path': plugin.url_for("lists_trakt_liked_lists", page = int(page) + 1), 'icon': get_icon_path("traktlikedlists"), # TODO }) return items