def _lists_trakt_show_list(list_items): genres_dict = trakt.trakt_get_genres("tv") if type(list_items) == str: import urllib list_items = eval(urllib.unquote(list_items)) items = [] for list_item in list_items: item = None item_type = list_item["type"] if item_type == "show": tvdb_id = list_item["show"]["ids"]["tvdb"] if tvdb_id != "" and tvdb_id != None: show = list_item["show"] info = get_tvshow_metadata_trakt(show, genres_dict) context_menu = [ (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("tv_add_to_library", id=tvdb_id))), (_("TV show information"), 'Action(Info)'), ("{0}".format( _("Remove from library").replace( _("Library").lower(), _("Playlist").lower())), "RunPlugin({0})".format( plugin.url_for("lists_remove_show_from_list", src="tvdb", id=tvdb_id))) ] if plugin.get_setting(SETTING_TRAKT_LIST_ARTWORK, bool) == False: item = ({ 'label': info['title'], 'path': plugin.url_for("tv_tvshow", id=tvdb_id), 'context_menu': context_menu, 'thumbnail': info['poster'], 'icon': get_icon_path("tv"), 'poster': info['poster'], 'properties': { 'fanart_image': info['fanart'] }, 'info_type': 'video', 'stream_info': { 'video': {} }, 'info': info }) else: item = make_tvshow_item(info) else: item = None elif item_type == "season": tvdb_id = list_item["show"]["ids"]["tvdb"] season = list_item["season"] show = list_item["show"] show_info = get_tvshow_metadata_trakt(show, genres_dict) season_info = get_season_metadata_trakt(show_info, season, genres_dict) label = "{0} - Season {1}".format(show["title"], season["number"]) context_menu = [ (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("tv_add_to_library", id=tvdb_id))), ("%s %s" % (_("Season"), _("Information").lower()), 'Action(Info)'), ("{0}".format( _("Remove from library").replace( _("Library").lower(), _("Playlist").lower())), "RunPlugin({0})".format( plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=list_item["season"]["number"]))) ] item = ({ 'label': label, 'path': plugin.url_for("tv_season", id=tvdb_id, season_num=list_item["season"]["number"]), 'context_menu': context_menu, 'info': season_info, 'thumbnail': season_info['poster'], 'icon': get_icon_path("tv"), 'poster': season_info['poster'], 'properties': { 'fanart_image': season_info['fanart'] }, }) elif item_type == "episode": tvdb_id = list_item["show"]["ids"]["tvdb"] episode = list_item["episode"] show = list_item["show"] season_number = episode["season"] episode_number = episode["number"] show_info = get_tvshow_metadata_trakt(show, genres_dict) episode_info = get_episode_metadata_trakt(show_info, episode) label = "{0} - S{1}E{2} - {3}".format(show_info["title"], season_number, episode_number, episode_info["title"]) context_menu = [ ("{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='select'))), ("%s %s" % (_("Episode"), _("Information").lower()), 'Action(Info)'), (_("Add to playlist"), "RunPlugin({0})".format( plugin.url_for("lists_add_episode_to_list", src='tvdb', id=tvdb_id, season=season_number, episode=episode_number))), ("{0}".format( _("Remove from library").replace( _("Library").lower(), _("Playlist").lower())), "RunPlugin({0})".format( plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=season_number, episode=episode_number))) ] item = ({ 'label': label, 'path': plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='default'), 'context_menu': context_menu, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'stream_info': { 'video': {} }, 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'icon': get_icon_path("tv"), 'properties': { 'fanart_image': episode_info['fanart'] }, }) elif item_type == "movie": movie = list_item["movie"] movie_info = get_trakt_movie_metadata(movie) try: tmdb_id = movie_info['tmdb'] except: tmdb_id = "" try: imdb_id = movie_info['imdb'] except: imdb_id = "" if tmdb_id != None and tmdb_id != "": src = "tmdb" id = tmdb_id elif imdb_id != None and mdb_id != "": src = "imdb" id = imdb_id else: src = "" id = "" if src == "": item = None else: if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"): context_menu = [ (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.qlickplay,info=playtrailer,id={0})". format(id)), ("[COLOR ff0084ff]Q[/COLOR]lick[COLOR ff0084ff]P[/COLOR]lay", "RunScript(script.qlickplay,info=movieinfo,id={0})". format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.qlickplay/?info=similarmovies&id={0})" .format(id)) ] elif xbmc.getCondVisibility( "system.hasaddon(script.extendedinfo)"): context_menu = [ (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.extendedinfo,info=playtrailer,id={0})" .format(id)), ((_("Extended movie info"), _("Extended movie info"), "RunScript(script.extendedinfo,info=extendedinfo,id={0})" .format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.extendedinfo/?info=similarmovies&id={0})" .format(id))) ] else: context_menu = [ (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("movies_add_to_library", src=src, id=id))) ] context_menu.append( ("%s %s (%s)" % ("Related", _("movies"), "Trakt"), "ActivateWindow(10025,{0})".format( plugin.url_for("movies_related", id=id, page=1)))) context_menu.append( ("{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("movies_play", src=src, id=id, mode='select')))) context_menu.append( (_("Add to playlist"), "RunPlugin({0})".format( plugin.url_for("lists_add_movie_to_list", src=src, id=id)))) context_menu.append( (_("Movie information"), 'Action(Info)')) if imdb_id != None and imdb_id != "": context_menu.append( ("Show Actors", "ActivateWindow(10025,{0})".format( plugin.url_for("people_list_movie_people", id=imdb_id, source="imdb", fanart=get_background_path())))) elif tmdb_id != None and tmdb_id != "": context_menu.append( ("Show Actors", "ActivateWindow(10025,{0})".format( plugin.url_for("people_list_movie_people", id=tmdb_id, source="tmdb", fanart=get_background_path())))) item = make_movie_item(movie_info, True) elif item_type == "person": person_id = list_item['person']['ids']['trakt'] person_tmdb_id = list_item['person']['ids']['tmdb'] context_menu = [] try: import_tmdb() person_images = tmdb.People( person_tmdb_id).images()['profiles'] person_image = 'https://image.tmdb.org/t/p/w640' + person_images[ 0]['file_path'] except: person_image = '' person_name = to_utf8(list_item['person']['name']) item = ({ 'label': person_name, 'path': plugin.url_for("trakt_movies_person", person_id=person_id), 'context_menu': context_menu, #'info': season_info, 'thumbnail': person_image, 'icon': get_icon_path("movies"), 'poster': person_image, 'properties': { 'fanart_image': person_image }, }) if item is not None: items.append(item) for item in items: item['properties'] = {'fanart_image': get_background_path()} return items
def _lists_trakt_show_list(list_items): genres_dict = trakt.trakt_get_genres("tv") if type(list_items) == str: import urllib list_items = eval(urllib.unquote(list_items)) items = [] for list_item in list_items[:25]: item = None item_type = list_item["type"] if item_type == "show": tvdb_id = list_item["show"]["ids"]["tvdb"] show = list_item["show"] info = get_tvshow_metadata_trakt(show, genres_dict) context_menu = [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id)) ), ( _("Show info"), 'Action(Info)' ), ( _("Remove from list"), "RunPlugin({0})".format(plugin.url_for("lists_remove_show_from_list", src="tvdb", id=tvdb_id)) ) ] item = ({ 'label': info['title'], 'path': plugin.url_for("tv_tvshow", id=tvdb_id), 'context_menu': context_menu, 'thumbnail': info['poster'], 'icon': "DefaultVideo.png", 'poster': info['poster'], 'properties' : {'fanart_image' : info['fanart']}, 'info_type': 'video', 'stream_info': {'video': {}}, 'info': info }) elif item_type == "season": tvdb_id = list_item["show"]["ids"]["tvdb"] season = list_item["season"] show = list_item["show"] show_info = get_tvshow_metadata_trakt(show, genres_dict) season_info = get_season_metadata_trakt(show_info,season, genres_dict) label = "{0} - Season {1}".format(show["title"],season["number"]) context_menu = [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id)) ), ( _("Show info"), 'Action(Info)' ), ( _("Remove from list"), "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=list_item["season"]["number"])) ) ] item = ({ 'label': label, 'path': plugin.url_for(tv_season, id=tvdb_id, season_num=list_item["season"]["number"]), 'context_menu': context_menu, 'info': season_info, 'thumbnail': season_info['poster'], 'icon': "DefaultVideo.png", 'poster': season_info['poster'], 'properties': {'fanart_image': season_info['fanart']}, }) elif item_type == "episode": tvdb_id = list_item["show"]["ids"]["tvdb"] episode = list_item["episode"] show = list_item["show"] season_number = episode["season"] episode_number = episode["number"] show_info = get_tvshow_metadata_trakt(show, genres_dict) episode_info = get_episode_metadata_trakt(show_info, episode) label = "{0} - S{1}E{2} - {3}".format(show_info["title"], season_number, episode_number, episode_info["title"]) context_menu = [ ( _("Select stream..."), "PlayMedia({0})".format( plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='select')) ), ( _("Show info"), 'Action(Info)' ), ( _("Add to list"), "RunPlugin({0})".format(plugin.url_for("lists_add_episode_to_list", src='tvdb', id=tvdb_id, season=season_number, episode=episode_number)) ), ( _("Remove from list"), "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=season_number, episode = episode_number)) ) ] item = ({ 'label': label, 'path': plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='default'), 'context_menu': context_menu, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'stream_info': {'video': {}}, 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'icon': "DefaultVideo.png", 'properties': {'fanart_image': episode_info['fanart']}, }) elif item_type == "movie": movie = list_item["movie"] movie_info = get_trakt_movie_metadata(movie) item = make_movie_item(movie_info, True) if item is not None: items.append(item) if len(list_items) >= 25: items.append({ 'label': _('Next >>'), 'path': plugin.url_for(_lists_trakt_show_list, list_items=str(list_items[25:])) }) return items
def _lists_trakt_show_list(list_items): genres_dict = trakt.trakt_get_genres("tv") if type(list_items) == str: import urllib list_items = eval(urllib.unquote(list_items)) items = [] for list_item in list_items: item = None item_type = list_item["type"] if item_type == "show": tvdb_id = list_item["show"]["ids"]["tvdb"] if tvdb_id != "" and tvdb_id != None: show = list_item["show"] info = get_tvshow_metadata_trakt(show, genres_dict) context_menu = [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id)) ), ( _("TV show information"), 'Action(Info)' ), ( "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())), "RunPlugin({0})".format(plugin.url_for("lists_remove_show_from_list", src="tvdb", id=tvdb_id)) ) ] if plugin.get_setting(SETTING_TRAKT_LIST_ARTWORK, bool) == False: item = ({ 'label': info['title'], 'path': plugin.url_for("tv_tvshow", id=tvdb_id), 'context_menu': context_menu, 'thumbnail': info['poster'], 'icon': get_icon_path("tv"), 'poster': info['poster'], 'properties' : {'fanart_image' : info['fanart']}, 'info_type': 'video', 'stream_info': {'video': {}}, 'info': info }) else: item = make_tvshow_item(info) else: item = None elif item_type == "season": tvdb_id = list_item["show"]["ids"]["tvdb"] season = list_item["season"] show = list_item["show"] show_info = get_tvshow_metadata_trakt(show, genres_dict) season_info = get_season_metadata_trakt(show_info,season, genres_dict) label = "{0} - Season {1}".format(show["title"],season["number"]) context_menu = [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("tv_add_to_library", id=tvdb_id)) ), ( "%s %s" % (_("Season"), _("Information").lower()), 'Action(Info)' ), ( "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())), "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=list_item["season"]["number"])) ) ] item = ({ 'label': label, 'path': plugin.url_for("tv_season", id=tvdb_id, season_num=list_item["season"]["number"]), 'context_menu': context_menu, 'info': season_info, 'thumbnail': season_info['poster'], 'icon': get_icon_path("tv"), 'poster': season_info['poster'], 'properties': {'fanart_image': season_info['fanart']}, }) elif item_type == "episode": tvdb_id = list_item["show"]["ids"]["tvdb"] episode = list_item["episode"] show = list_item["show"] season_number = episode["season"] episode_number = episode["number"] show_info = get_tvshow_metadata_trakt(show, genres_dict) episode_info = get_episode_metadata_trakt(show_info, episode) label = "{0} - S{1}E{2} - {3}".format(show_info["title"], season_number, episode_number, episode_info["title"]) context_menu = [ ( "{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='select')) ), ( "%s %s" % (_("Episode"), _("Information").lower()), 'Action(Info)' ), ( _("Add to playlist"), "RunPlugin({0})".format(plugin.url_for("lists_add_episode_to_list", src='tvdb', id=tvdb_id, season=season_number, episode=episode_number)) ), ( "{0}".format(_("Remove from library").replace(_("Library").lower(),_("Playlist").lower())), "RunPlugin({0})".format(plugin.url_for("lists_remove_season_from_list", src="tvdb", id=tvdb_id, season=season_number, episode = episode_number)) ) ] item = ({ 'label': label, 'path': plugin.url_for("tv_play", id=tvdb_id, season=season_number, episode=episode_number, mode='default'), 'context_menu': context_menu, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'stream_info': {'video': {}}, 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'icon': get_icon_path("tv"), 'properties': {'fanart_image': episode_info['fanart']}, }) elif item_type == "movie": movie = list_item["movie"] movie_info = get_trakt_movie_metadata(movie) try: tmdb_id = movie_info['tmdb'] except: tmdb_id = "" try: imdb_id = movie_info['imdb'] except: imdb_id = "" if tmdb_id != None and tmdb_id != "": src = "tmdb" id = tmdb_id elif imdb_id != None and mdb_id != "": src = "imdb" id = imdb_id else: src = "" id = "" if src == "": item = None else: if xbmc.getCondVisibility("system.hasaddon(script.qlickplay)"): context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.qlickplay,info=playtrailer,id={0})".format(id)), ("[COLOR ff0084ff]Q[/COLOR]lick[COLOR ff0084ff]P[/COLOR]lay", "RunScript(script.qlickplay,info=movieinfo,id={0})".format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.qlickplay/?info=similarmovies&id={0})".format(id))] elif xbmc.getCondVisibility("system.hasaddon(script.extendedinfo)"): context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id))), ("%s %s" % (_("Movie"), _("Trailer").lower()), "RunScript(script.extendedinfo,info=playtrailer,id={0})".format(id)), ( (_("Extended movie info"),_("Extended movie info"), "RunScript(script.extendedinfo,info=extendedinfo,id={0})".format(id)), ("%s %s (%s)" % ("Recommended", _("movies"), "TMDb"), "ActivateWindow(10025,plugin://script.extendedinfo/?info=similarmovies&id={0})".format(id)))] else: context_menu = [( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("movies_add_to_library", src=src, id=id)))] context_menu.append(("%s %s (%s)" % ("Related", _("movies"), "Trakt"), "ActivateWindow(10025,{0})".format(plugin.url_for("movies_related", id=id, page=1)))) context_menu.append(("{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("movies_play", src=src, id=id, mode='select')))) context_menu.append((_("Add to playlist"), "RunPlugin({0})".format(plugin.url_for("lists_add_movie_to_list", src=src, id=id)))) context_menu.append((_("Movie information"), 'Action(Info)')) if imdb_id != None and imdb_id != "": context_menu.append(("Show Actors", "ActivateWindow(10025,{0})".format(plugin.url_for("people_list_movie_people", id=imdb_id, source="imdb", fanart=get_background_path())))) elif tmdb_id != None and tmdb_id != "": context_menu.append(("Show Actors", "ActivateWindow(10025,{0})".format(plugin.url_for("people_list_movie_people", id=tmdb_id, source="tmdb", fanart=get_background_path())))) item = make_movie_item(movie_info, True) elif item_type == "person": person_id = list_item['person']['ids']['trakt'] person_tmdb_id = list_item['person']['ids']['tmdb'] context_menu= [] try: import_tmdb() person_images = tmdb.People(person_tmdb_id).images()['profiles'] person_image = 'https://image.tmdb.org/t/p/w640' + person_images[0]['file_path'] except: person_image = '' person_name = to_utf8(list_item['person']['name']) item = ({ 'label': person_name, 'path': plugin.url_for("trakt_movies_person", person_id=person_id), 'context_menu': context_menu, #'info': season_info, 'thumbnail': person_image, 'icon': get_icon_path("movies"), 'poster': person_image, 'properties': {'fanart_image': person_image}, }) if item is not None: items.append(item) for item in items: item['properties'] = {'fanart_image' : get_background_path()} return items