def root(): """ Root directory """ items = [{ 'label': _("Movies"), 'path': plugin.url_for("movies"), 'icon': get_icon_path("movies"), }, { 'label': _("TV shows"), 'path': plugin.url_for("tv"), 'icon': get_icon_path("tv"), }, { 'label': _("Music"), 'path': plugin.url_for("music"), 'icon': get_icon_path("music"), }, { 'label': _("Live"), 'path': plugin.url_for("live"), 'icon': get_icon_path("live"), }, { 'label': _("Lists"), 'path': plugin.url_for("lists"), 'icon': get_icon_path("lists"), }, { 'label': _("Search"), 'path': plugin.url_for("root_search"), 'icon': get_icon_path("search"), }] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image': get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music_top_artists_by_country(country, page): results = lastfm.get_top_artists_by_country(country, page) artists = results["topartists"]["artist"] items = [] for artist in artists: large_image = artist["image"][-1]["#text"] name = to_utf8(artist["name"]) context_menu = [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_artist_to_library", artist_name=name)) ) ] item = { 'label': name, 'path': plugin.url_for("music_artist_albums", artist_name=name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def list_tmdb_items(result): if FORCE == True: plugin.set_view_mode(VIEW) genres_dict = get_base_genres() movies = [get_movie_metadata(item, None) for item in result['results']] items = [make_movie_item(movie) for movie in movies] if 'page' in result: page = int(result['page']) pages = int(result['total_pages']) args = caller_args() if pages > page: args['page'] = str(page + 1) items.append({ 'label': "{0} >> ({1}/{2})".format(_("Next page"), page + 1, pages), 'icon': get_icon_path("item_next"), 'path': plugin.url_for(caller_name(), **args), 'properties': { 'fanart_image': get_background_path() }, }) if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW) else: return plugin.finish(items=items, sort_methods=SORT)
def music_top_artists_by_country(country, page): results = lastfm.get_top_artists_by_country(country, page) artists = results["topartists"]["artist"] items = [] for artist in artists: large_image = artist["image"][-1]["#text"] name = to_utf8(artist["name"]) context_menu = [(_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_artist_to_library", artist_name=name)))] item = { 'label': name, 'path': plugin.url_for("music_artist_albums", artist_name=name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music_artist_albums(artist_name, page): artist_name = to_utf8(artist_name) results = lastfm.get_artist_top_albums(artist_name, page) items = [{ 'label': _("All Tracks"), 'path': plugin.url_for("music_artist_tracks", artist_name=artist_name), 'icon': get_icon_path("music") }] for album in results["album"]: album_name = to_utf8(album["name"]) image = album['image'][-1]['#text'] artist_album_name = to_utf8(album['artist']['name']) context_menu = [(_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_album_to_library", artist_name=artist_album_name, album_name=album_name)))] item = { 'thumbnail': image, 'label': "{0}".format(album_name), 'info': { 'title': album_name, 'artist': [artist_album_name], }, 'info_type': 'music', 'path': plugin.url_for("music_artist_album_tracks", artist_name=artist_name, album_name=album_name), 'context_menu': context_menu } items.append(item) if results["@attr"]["totalPages"] > page: next_page = int(page) + 1 items.append({ 'label': _("Next >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_artist_albums", artist_name=artist_name, page=next_page) }) if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music_search_album_term(term, page): search_results = lastfm.search_album(term, page) albums = search_results["albummatches"]["album"] items_per_page = search_results["opensearch:itemsPerPage"] start_index = search_results["opensearch:startIndex"] total_results = search_results["opensearch:totalResults"] items = [] for album in albums: large_image = album["image"][-1]["#text"] album_name = to_utf8(album["name"]) artist_name = to_utf8(album["artist"]) context_menu = [(_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_album_to_library", artist_name=artist_name, album_name=album_name)))] item = { 'label': "{0} - {1}".format(artist_name, album_name), 'path': plugin.url_for("music_artist_album_tracks", artist_name=artist_name, album_name=album_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if start_index + items_per_page < total_results: items.append({ 'label': "{0} {1}".format(_("Next page"), " >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_search_album_term", term=term, page=int(page) + 1) }) if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
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
def music_artist_tracks(artist_name, page): artist_name = to_utf8(artist_name) results = lastfm.get_artist_top_tracks(artist_name, page) items = [] for track in results["track"]: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) context_menu = [ ( _("Context player"), "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)) ), ( _("Musicvideo"), "PlayMedia({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode='default')) ) ] if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode) == "audio": item = { 'label': track_name, 'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info_type': 'music', 'context_menu': context_menu, } else: item = { 'label': track_name, 'path': plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name), 'thumbnail': large_image, 'icon': "DefaultMusicVideo.png", 'poster': large_image, 'info_type': 'music', 'context_menu': context_menu, } items.append(item) if results["@attr"]["totalPages"] > page: items.append({ 'label': _("Next >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_artist_tracks", artist_name=artist_name, page=int(page) + 1) }) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_top_tracks_by_country(country, page): results = lastfm.get_top_tracks_by_country(country, page) tracks = results["tracks"]["track"] items = [] for track in tracks: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) artist_name = to_utf8(track["artist"]["name"]) context_menu = [ ("{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context'))), (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name))) #, # ( # _("Music video"), # "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, # track_name=track_name, mode='context')) # ) ] item = { 'label': "{0} - {1}".format(artist_name, track_name), 'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def root(): """ Root directory """ items = [ { 'label': _("Movies"), 'path': plugin.url_for("movies"), 'icon': get_icon_path("movies"), 'thumbnail': get_icon_path("movies"), }, { 'label': _("TV shows"), 'path': plugin.url_for("tv"), 'icon': get_icon_path("tv"), 'thumbnail': get_icon_path("tv"), }, { 'label': _("Music"), 'path': plugin.url_for("music"), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': _("TV channels"), 'path': plugin.url_for("live"), 'icon': get_icon_path("live"), 'thumbnail': get_icon_path("live"), }, { 'label': _("Playlists"), 'path': plugin.url_for("lists"), 'icon': get_icon_path("lists"), 'thumbnail': get_icon_path("lists"), 'context_menu': [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_all_lists_to_library")) ) ], }, { 'label': _("Enter search string"), 'path': plugin.url_for("root_search"), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), } ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_search_track_term(term, page): search_results = lastfm.search_track(term, page) tracks = search_results["trackmatches"]["track"] items_per_page = search_results["opensearch:itemsPerPage"] start_index = search_results["opensearch:startIndex"] total_results = search_results["opensearch:totalResults"] items = [] for track in tracks: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) artist_name = to_utf8(track["artist"]) context_menu = [ ( "{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)) ), ( "{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()), "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode='context')) ) ] item = { 'label': "{0} - {1}".format(artist_name, track_name), 'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if start_index + items_per_page < total_results: items.append({ 'label': _("Next >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_search_track_term", term=term, page=int(page) + 1) }) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_artist_album_tracks(artist_name, album_name): artist_name = to_utf8(artist_name) album_name = to_utf8(album_name) results = lastfm.get_album_info(artist_name, album_name) items = [] for track in results["tracks"]["track"]: track_name = to_utf8(track["name"]) track_number = track["@attr"]["rank"] image = results["image"][-1]["#text"] context_menu = [ ( "{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name, album_name=album_name)) ), ( "{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()), "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode='default')) ) ] if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode) == "audio": item = { 'label': "{0}. {1}".format(track_number, track_name), 'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name), 'thumbnail': image, 'icon': "DefaultMusic.png", 'poster': image, 'info_type': 'music', 'context_menu': context_menu, } else: item = { 'label': "{0}. {1}".format(track_number, track_name), 'path': plugin.url_for("music_play_video", artist_name=artist_name, album_name=album_name, track_name=track_name), 'thumbnail': image, 'icon': "DefaultMusicVideo.png", 'poster': image, 'info_type': 'music', 'context_menu': context_menu, } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_artist(name): name = to_utf8(name) items = [ { 'label': _("Tracks"), 'path': plugin.url_for("music_artist_tracks", artist_name=name), 'icon': get_icon_path("music") }, { 'label': _("Albums"), 'path': plugin.url_for("music_artist_albums", artist_name=name), 'icon': get_icon_path("music") }, ] if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def lists(): """ Lists directory """ items = [ { 'label': "{0} {1} (Trakt)".format("\"Liked\"", _("Playlists").lower()), 'path': plugin.url_for("lists_trakt_liked_lists", page=1), 'icon': get_icon_path("traktlikedlists"), 'thumbnail': get_icon_path("traktlikedlists"), 'context_menu': [(_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("lists_trakt_add_liked_to_library")))] }, { 'label': "{0} {1} (Trakt)".format(_("Watch your"), _("Playlists").lower()), 'path': plugin.url_for("lists_trakt_my_lists"), 'icon': get_icon_path("traktmylists"), 'thumbnail': get_icon_path("traktmylists"), 'context_menu': [(_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("lists_trakt_add_my_lists_to_library")))] }, { 'label': "{0}: {1} (Trakt)".format(_("Search"), _("Playlist")), 'path': plugin.url_for("lists_trakt_search_for_lists"), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image': get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def trakt_my_tv(): """ TV directory """ items = [ { 'label': _("Collection"), 'path': plugin.url_for(trakt_tv_collection), 'icon': get_icon_path("traktcollection"), # TODO 'context_menu': [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for(trakt_tv_collection_to_library)) ) ], }, { 'label': _("Watchlist"), 'path': plugin.url_for(trakt_tv_watchlist), 'icon': get_icon_path("traktwatchlist"), # TODO 'context_menu': [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for(trakt_tv_watchlist_to_library)) ) ], }, { 'label': _("Next episodes"), 'path': plugin.url_for(trakt_tv_next_episodes), 'icon': get_icon_path("traktnextepisodes"), # TODO }, { 'label': _("Calendar"), 'path': plugin.url_for(trakt_tv_calendar), 'icon': get_icon_path("traktcalendar"), # TODO }, { 'label': _("Recommendations"), 'path': plugin.url_for(trakt_tv_recommendations), 'icon': get_icon_path("traktrecommendations"), # TODO } ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def root(): """ Root directory """ items = [ {"label": _("Movies"), "path": plugin.url_for("movies"), "icon": get_icon_path("movies")}, {"label": _("TV shows"), "path": plugin.url_for("tv"), "icon": get_icon_path("tv")}, {"label": _("Music"), "path": plugin.url_for("music"), "icon": get_icon_path("music")}, {"label": _("Live"), "path": plugin.url_for("live"), "icon": get_icon_path("live")}, {"label": _("Lists"), "path": plugin.url_for("lists"), "icon": get_icon_path("lists")}, {"label": _("Search"), "path": plugin.url_for("root_search"), "icon": get_icon_path("search")}, ] fanart = plugin.addon.getAddonInfo("fanart") for item in items: item["properties"] = {"fanart_image": get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def list_tmdb_items(result): if FORCE == True: plugin.set_view_mode(VIEW) genres_dict = get_base_genres() movies = [get_movie_metadata(item, None) for item in result['results']] items = [make_movie_item(movie) for movie in movies] if 'page' in result: page = int(result['page']) pages = int(result['total_pages']) args = caller_args() if pages > page: args['page'] = str(page + 1) items.append({ 'label': "{0} >> ({1}/{2})".format(_("Next page"), page + 1, pages), 'icon': get_icon_path("item_next"), 'path': plugin.url_for(caller_name(), **args), 'properties' : {'fanart_image' : get_background_path()}, }) if FORCE == True: return plugin.finish(items=items, sort_methods=SORT, view_mode=VIEW) else: return plugin.finish(items=items, sort_methods=SORT)
def music_artist_albums(artist_name, page): artist_name = to_utf8(artist_name) results = lastfm.get_artist_top_albums(artist_name, page) items = [ { 'label': _("All Tracks"), 'path': plugin.url_for("music_artist_tracks", artist_name=artist_name), 'icon': get_icon_path("music") } ] for album in results["album"]: album_name = to_utf8(album["name"]) image = album['image'][-1]['#text'] artist_album_name = to_utf8(album['artist']['name']) context_menu = [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_album_to_library", artist_name=artist_album_name, album_name=album_name)) ) ] item = { 'thumbnail': image, 'label': "{0}".format(album_name), 'info': { 'title': album_name, 'artist': [artist_album_name], }, 'info_type': 'music', 'path': plugin.url_for("music_artist_album_tracks", artist_name=artist_name, album_name=album_name), 'context_menu': context_menu } items.append(item) if results["@attr"]["totalPages"] > page: next_page = int(page) + 1 items.append({ 'label': _("Next >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_artist_albums", artist_name=artist_name, page=next_page) }) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_top_tracks_by_country(country, page): results = lastfm.get_top_tracks_by_country(country, page) tracks = results["tracks"]["track"] items = [] for track in tracks: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) artist_name = to_utf8(track["artist"]["name"]) context_menu = [ ( "{0} {1}...".format(_("Select"), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)) )#, # ( # _("Music video"), # "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, # track_name=track_name, mode='context')) # ) ] item = { 'label': "{0} - {1}".format(artist_name, track_name), 'path': plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_search_album_term(term, page): search_results = lastfm.search_album(term, page) albums = search_results["albummatches"]["album"] items_per_page = search_results["opensearch:itemsPerPage"] start_index = search_results["opensearch:startIndex"] total_results = search_results["opensearch:totalResults"] items = [] for album in albums: large_image = album["image"][-1]["#text"] album_name = to_utf8(album["name"]) artist_name = to_utf8(album["artist"]) context_menu = [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_album_to_library", artist_name=artist_name, album_name=album_name)) ) ] item = { 'label': "{0} - {1}".format(artist_name, album_name), 'path': plugin.url_for("music_artist_album_tracks", artist_name=artist_name, album_name=album_name), 'thumbnail': large_image, 'icon': "DefaultMusic.png", 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': 'music', 'context_menu': context_menu } items.append(item) if start_index + items_per_page < total_results: items.append({ 'label': "{0} {1}".format(_("Next page"), " >>"), 'icon': get_icon_path("item_next"), 'path': plugin.url_for("music_search_album_term", term=term, page=int(page) + 1) }) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def lists(): """ Lists directory """ items = [ { 'label': "{0} {1}".format("\"Liked\"", _("Playlists").lower()), 'path': plugin.url_for("lists_trakt_liked_lists", page = 1), 'icon': get_icon_path("traktlikedlists"), 'thumbnail': get_icon_path("traktlikedlists"), 'context_menu': [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_liked_to_library")) ) ] }, { 'label': "{0} {1}".format(_("Watch your"), _("Playlists").lower()), 'path': plugin.url_for("lists_trakt_my_lists"), 'icon': get_icon_path("traktmylists"), 'thumbnail': get_icon_path("traktmylists"), 'context_menu': [ ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("lists_trakt_add_my_lists_to_library")) ) ] }, { 'label': "{0}".format(_("Enter search string")), 'path': plugin.url_for("lists_trakt_search_for_lists"), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def lists(): """ Lists directory """ items = [ { 'label': _("Liked lists"), 'path': plugin.url_for("lists_trakt_liked_lists", page = 1), 'icon': get_icon_path("traktlikedlists"), }, { 'label': _("My lists"), 'path': plugin.url_for("lists_trakt_my_lists"), 'icon': get_icon_path("traktmylists"), }, { 'label': _("Search list"), 'path': plugin.url_for("lists_trakt_search_for_lists"), 'icon': get_icon_path("search"), }, ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def trakt_my_movies(): """ Trakt movies directory """ items = [ { 'label': _("Collection"), 'path': plugin.url_for(trakt_movies_collection), 'icon': get_icon_path("traktcollection"), 'context_menu': [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for(trakt_movies_collection_to_library)) ) ], }, { 'label': _("Watchlist"), 'path': plugin.url_for(trakt_movies_watchlist), 'icon': get_icon_path("traktwatchlist"), 'context_menu': [ ( _("Add to library"), "RunPlugin({0})".format(plugin.url_for(trakt_movies_watchlist_to_library)) ) ], }, { 'label': _("Recommendations"), 'path': plugin.url_for(movies_trakt_recommendations), 'icon': get_icon_path("traktrecommendations"), } ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def movies(): """ Movies directory """ items = [ { 'label': _("Search (Trakt)"), 'path': plugin.url_for(trakt_movies_search, page='1'), 'icon': get_icon_path("search"), }, { 'label': _("Personal (Trakt)"), 'path': plugin.url_for(trakt_my_movies), 'icon': get_icon_path("trakt"), }, { 'label': _("Most played (Trakt)"), 'path': plugin.url_for(trakt_movies_played, page='1'), 'icon': get_icon_path("player"), }, { 'label': _("Most watched (Trakt)"), 'path': plugin.url_for(trakt_movies_watched, page='1'), 'icon': get_icon_path("traktwatchlist"), }, { 'label': _("Most collected (Trakt)"), 'path': plugin.url_for(trakt_movies_collected, page='1'), 'icon': get_icon_path("traktcollection"), }, { 'label': _("Popular (Trakt)"), 'path': plugin.url_for(trakt_movies_popular, page='1'), 'icon': get_icon_path("traktrecommendations"), }, { 'label': _("Trending (Trakt)"), 'path': plugin.url_for(trakt_movies_trending, page='1'), 'icon': get_icon_path("trending"), }, { 'label': _("Search (TMDb)"), 'path': plugin.url_for(tmdb_movies_search), 'icon': get_icon_path("search"), }, { 'label': _("Blockbusters (TMDb)"), 'path': plugin.url_for(tmdb_movies_blockbusters, page='1'), 'icon': get_icon_path("most_voted"), }, { 'label': _("Genres (TMDb)"), 'path': plugin.url_for(tmdb_movies_genres), 'icon': get_icon_path("genres"), }, { 'label': _("In theatres (TMDb)"), 'path': plugin.url_for(tmdb_movies_now_playing, page='1'), 'icon': get_icon_path("intheatres"), }, { 'label': _("Popular (TMDb)"), 'path': plugin.url_for(tmdb_movies_most_popular, page='1'), 'icon': get_icon_path("popular"), }, { 'label': _("Top rated (TMDb)"), 'path': plugin.url_for(tmdb_movies_top_rated, page='1'), 'icon': get_icon_path("top_rated"), } ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_top_tracks(page): results = lastfm.get_top_tracks(page) #dialogs.notify(msg=_(SETTING_PREFERRED_MUSIC_TYPE), title=_(plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode)), delay=1000, image=get_icon_path("tv")) tracks = results["tracks"]["track"] items = [] for track in tracks: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) artist_name = to_utf8(track["artist"]["name"]) if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode) == "audio": path = plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name) icon = "DefaultMusic.png" info_type = "music" context_menu = [ ( "{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)) )#, # ( # _("Music video"), # "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, # track_name=track_name, mode='context')) # ) ] else: path = plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name) icon = "DefaultMusicVideo.png" info_type = "musicvideos" context_menu = [ ( "{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()), "PlayMedia({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode='context')) ), ( _("Scan item to library"), "RunPlugin({0})".format(plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name)) ), ( _("Music"), "RunPlugin({0})".format(plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')) ) ] item = { 'label': "{0} - {1}".format(artist_name, track_name), 'path': path, 'thumbnail': large_image, 'icon': icon, 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': info_type, 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_top_tracks(page): results = lastfm.get_top_tracks(page) #dialogs.notify(msg=_(SETTING_PREFERRED_MUSIC_TYPE), title=_(plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode)), delay=1000, image=get_icon_path("tv")) tracks = results["tracks"]["track"] items = [] for track in tracks: large_image = track["image"][-1]["#text"] track_name = to_utf8(track["name"]) artist_name = to_utf8(track["artist"]["name"]) if plugin.get_setting(SETTING_PREFERRED_MUSIC_TYPE, unicode) == "audio": path = plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name) icon = "DefaultMusic.png" info_type = "music" context_menu = [ ("{0} {1} {2}...".format(_("Select"), _("Audio").lower(), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context'))), (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name))) #, # ( # _("Music video"), # "RunPlugin({0})".format(plugin.url_for("music_play_video", artist_name=artist_name, # track_name=track_name, mode='context')) # ) ] else: path = plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name) icon = "DefaultMusicVideo.png" info_type = "musicvideos" context_menu = [("{0} {1} {2}...".format(_("Select"), _("Video").lower(), _("Stream").lower()), "PlayMedia({0})".format( plugin.url_for("music_play_video", artist_name=artist_name, track_name=track_name, mode='context'))), (_("Scan item to library"), "RunPlugin({0})".format( plugin.url_for("music_add_to_library", artist_name=artist_name, track_name=track_name))), (_("Music"), "RunPlugin({0})".format( plugin.url_for("music_play_audio", artist_name=artist_name, track_name=track_name, mode='context')))] item = { 'label': "{0} - {1}".format(artist_name, track_name), 'path': path, 'thumbnail': large_image, 'icon': icon, 'poster': large_image, 'info': { 'artist': artist_name, }, 'info_type': info_type, 'context_menu': context_menu } items.append(item) if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music(): items = [{ 'label': _("Enter search string"), 'path': plugin.url_for("music_search"), 'icon': get_icon_path("search"), }, { 'label': "{0} {1}".format(_("Top 100"), _("Artists")), 'path': plugin.url_for("music_top_artists"), 'icon': get_icon_path("top_rated"), }, { 'label': "{0} {1}".format(_("Top 100"), _("Tracks")), 'path': plugin.url_for("music_top_tracks"), 'icon': get_icon_path("trending"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "NL"), 'path': plugin.url_for("music_top_artists_by_country", country='netherlands'), 'icon': get_icon_path("top_nl"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "UK"), 'path': plugin.url_for("music_top_artists_by_country", country='united kingdom'), 'icon': get_icon_path("top_uk"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "US"), 'path': plugin.url_for("music_top_artists_by_country", country='united states'), 'icon': get_icon_path("top_us"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "CA"), 'path': plugin.url_for("music_top_artists_by_country", country='canada'), 'icon': get_icon_path("top_ca"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "AU"), 'path': plugin.url_for("music_top_artists_by_country", country='australia'), 'icon': get_icon_path("top_au"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "NL"), 'path': plugin.url_for("music_top_tracks_by_country", country='netherlands'), 'icon': get_icon_path("trending_nl"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "UK"), 'path': plugin.url_for("music_top_tracks_by_country", country='united kingdom'), 'icon': get_icon_path("trending_uk"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "US"), 'path': plugin.url_for("music_top_tracks_by_country", country='united states'), 'icon': get_icon_path("trending_us"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "CA"), 'path': plugin.url_for("music_top_tracks_by_country", country='canada'), 'icon': get_icon_path("trending_ca"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "AU"), 'path': plugin.url_for("music_top_tracks_by_country", country='australia'), 'icon': get_icon_path("trending_au"), }] for item in items: item['properties'] = {'fanart_image': get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music_search_term(term, page): items = [{ 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Albums"), "LastFM"), 'path': plugin.url_for("music_search_album_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Artists"), "LastFM"), 'path': plugin.url_for("music_search_artist_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Tracks"), "LastFM"), 'path': plugin.url_for("music_search_track_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Channels"), "Live addons"), 'path': plugin.url_for("live_search_term", term=term), 'icon': get_icon_path("live"), 'thumbnail': get_icon_path("live"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Playlists"), "Trakt"), 'path': plugin.url_for("lists_search_for_lists_term", term=term, page='1'), 'icon': get_icon_path("lists"), 'thumbnail': get_icon_path("lists"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "TMDb"), 'path': plugin.url_for("tmdb_movies_search_term", term=term, page='1'), 'icon': get_icon_path("movies"), 'thumbnail': get_icon_path("movies"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "Trakt"), 'path': plugin.url_for("trakt_movies_search_term", term=term, page='1'), 'icon': get_icon_path("movies"), 'thumbnail': get_icon_path("movies"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TMDb"), 'path': plugin.url_for("tmdb_tv_search_term", term=term, page='1'), 'icon': get_icon_path("tv"), 'thumbnail': get_icon_path("tv"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "Trakt"), 'path': plugin.url_for("trakt_tv_search_term", term=term, page='1'), 'icon': get_icon_path("tv"), 'thumbnail': get_icon_path("tv"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TVDb"), 'path': plugin.url_for("tv_search_term", term=term, page='1'), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Music"), plugin.addon.getAddonInfo('name')), 'path': plugin.url_for("music_search_term", term=term, page='1'), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, { 'label': "{0} {1}".format(_("Edit"), _("Search string").lower()), 'path': plugin.url_for("music_search_edit", term=term), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }] for item in items: item['properties'] = {'fanart_image': get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW) return items else: return items
def music(): items = [ { 'label': _("Enter search string"), 'path': plugin.url_for("music_search"), 'icon': get_icon_path("search"), }, { 'label': "{0} {1}".format(_("Top 100"), _("Artists")), 'path': plugin.url_for("music_top_artists"), 'icon': get_icon_path("top_rated"), }, { 'label': "{0} {1}".format(_("Top 100"), _("Tracks")), 'path': plugin.url_for("music_top_tracks"), 'icon': get_icon_path("trending"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "NL"), 'path': plugin.url_for("music_top_artists_by_country", country='netherlands'), 'icon': get_icon_path("top_nl"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "UK"), 'path': plugin.url_for("music_top_artists_by_country", country='united kingdom'), 'icon': get_icon_path("top_uk"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "US"), 'path': plugin.url_for("music_top_artists_by_country", country='united states'), 'icon': get_icon_path("top_us"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "CA"), 'path': plugin.url_for("music_top_artists_by_country", country='canada'), 'icon': get_icon_path("top_ca"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Artists"), "AU"), 'path': plugin.url_for("music_top_artists_by_country", country='australia'), 'icon': get_icon_path("top_au"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "NL"), 'path': plugin.url_for("music_top_tracks_by_country", country='netherlands'), 'icon': get_icon_path("trending_nl"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "UK"), 'path': plugin.url_for("music_top_tracks_by_country", country='united kingdom'), 'icon': get_icon_path("trending_uk"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "US"), 'path': plugin.url_for("music_top_tracks_by_country", country='united states'), 'icon': get_icon_path("trending_us"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "CA"), 'path': plugin.url_for("music_top_tracks_by_country", country='canada'), 'icon': get_icon_path("trending_ca"), }, { 'label': "{0} {1} ({2})".format(_("Top 100"), _("Tracks"), "AU"), 'path': plugin.url_for("music_top_tracks_by_country", country='australia'), 'icon': get_icon_path("trending_au"), } ] for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def tv(): """ TV directory """ items = [ { 'label': _("Search (Trakt)"), 'path': plugin.url_for(trakt_tv_search, page='1'), 'icon': get_icon_path("search"), }, { 'label': _("Personal (Trakt)"), 'path': plugin.url_for(trakt_my_tv), 'icon': get_icon_path("trakt"), }, { 'label': _("Aired (Trakt)"), 'path': plugin.url_for(trakt_tv_aired_yesterday, page='1'), 'icon': get_icon_path("aired"), }, { 'label': _("Premiered (Trakt)"), 'path': plugin.url_for(trakt_tv_premiered_last_week, page='1'), 'icon': get_icon_path("premiered"), }, { 'label': _("Most played (Trakt)"), 'path': plugin.url_for(trakt_tv_played, page='1'), 'icon': get_icon_path("player"), }, { 'label': _("Most watched (Trakt)"), 'path': plugin.url_for(trakt_tv_watched, page='1'), 'icon': get_icon_path("traktwatchlist"), }, { 'label': _("Most collected (Trakt)"), 'path': plugin.url_for(trakt_tv_collected, page='1'), 'icon': get_icon_path("traktcollection"), }, { 'label': _("Popular (Trakt)"), 'path': plugin.url_for(tv_trakt_popular, page='1'), 'icon': get_icon_path("traktrecommendations"), }, { 'label': _("Trending (Trakt)"), 'path': plugin.url_for(trakt_tv_trending, page='1'), 'icon': get_icon_path("trending"), }, # { # 'label': _("Updated (Trakt)"), # 'path': plugin.url_for(tv_trakt_updated, page='1'), # 'icon': get_icon_path("trending"), # }, { 'label': _("Search (TMDb)"), 'path': plugin.url_for(tmdb_tv_search), 'icon': get_icon_path("search"), }, { 'label': _("Genres (TMDb)"), 'path': plugin.url_for(tmdb_tv_genres), 'icon': get_icon_path("genres"), }, { 'label': _("On the air (TMDb)"), 'path': plugin.url_for(tmdb_tv_now_playing, page='1'), 'icon': get_icon_path("ontheair"), }, { 'label': _("Popular (TMDb)"), 'path': plugin.url_for(tmdb_tv_most_popular, page='1'), 'icon': get_icon_path("popular"), }, { 'label': _("Top rated (TMDb)"), 'path': plugin.url_for(tmdb_tv_top_rated, page='1'), 'icon': get_icon_path("top_rated"), }, { 'label': _("Search (TVDb)"), 'path': plugin.url_for(tvdb_tv_search), 'icon': get_icon_path("search"), } ] fanart = plugin.addon.getAddonInfo('fanart') for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items
def music_search_term(term, page): items = [ { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Albums"), "LastFM"), 'path': plugin.url_for("music_search_album_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Artists"), "LastFM"), 'path': plugin.url_for("music_search_artist_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Tracks"), "LastFM"), 'path': plugin.url_for("music_search_track_term", term=term, page='1'), 'icon': get_icon_path("music"), 'thumbnail': get_icon_path("music"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Channels"), "Live addons"), 'path': plugin.url_for("live_search_term", term=term), 'icon': get_icon_path("live"), 'thumbnail': get_icon_path("live"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Playlists"), "Trakt"), 'path': plugin.url_for("lists_search_for_lists_term", term=term, page='1'), 'icon': get_icon_path("lists"), 'thumbnail': get_icon_path("lists"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "TMDb"), 'path': plugin.url_for("tmdb_movies_search_term", term=term, page='1'), 'icon': get_icon_path("movies"), 'thumbnail': get_icon_path("movies"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Movies"), "Trakt"), 'path': plugin.url_for("trakt_movies_search_term", term=term, page='1'), 'icon': get_icon_path("movies"), 'thumbnail': get_icon_path("movies"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TMDb"), 'path': plugin.url_for("tmdb_tv_search_term", term=term, page='1'), 'icon': get_icon_path("tv"), 'thumbnail': get_icon_path("tv"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "Trakt"), 'path': plugin.url_for("trakt_tv_search_term", term=term, page='1'), 'icon': get_icon_path("tv"), 'thumbnail': get_icon_path("tv"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("TV shows"), "TVDb"), 'path': plugin.url_for("tv_search_term", term=term, page='1'), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, { 'label': "{0}: '{1}' - {2} ({3})".format(_("Search"), term, _("Music"), plugin.addon.getAddonInfo('name')), 'path': plugin.url_for("music_search_term", term=term, page='1'), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), }, { 'label': "{0} {1}".format(_("Edit"), _("Search string").lower()), 'path': plugin.url_for("music_search_edit", term=term), 'icon': get_icon_path("search"), 'thumbnail': get_icon_path("search"), } ] for item in items: item['properties'] = {'fanart_image' : get_background_path()} if FORCE == True: plugin.set_view_mode(VIEW); return items else: return items