def artist(artist_id): top_songs = xbmcgui.ListItem(utils.translate(30066)) top_songs.setArt({'thumb': thumbs.IMG_STAR, 'poster': thumbs.IMG_STAR}) related_artists = xbmcgui.ListItem(utils.translate(30067)) related_artists.setArt({ 'thumb': thumbs.IMG_ARTIST, 'poster': thumbs.IMG_ARTIST }) items = [ (utils.build_url(url=URL, paths=['browse', 'artist', artist_id, 'top-songs'], r_path=True), top_songs, True), (utils.build_url( url=URL, paths=['browse', 'artist', artist_id, 'related-artists'], r_path=True), related_artists, True) ] info = GMUSIC.get_artist_info(artist_id=artist_id, include_albums=True, max_top_tracks=0, max_rel_artist=0) if 'albums' in info: albums = info['albums'] albums.sort(key=itemgetter('name')) albums.sort(key=itemgetter('year'), reverse=True) items += listing.build_album_listitems(albums) listing.list_albums(items) else: listing.list_items([])
def new_releases(): releases = GMUSIC.get_new_releases() if releases: items = listing.build_album_listitems(releases) listing.list_albums(items) else: listing.list_items([])
def top_charts_albums(): top_charts = GMUSIC.get_top_chart() if top_charts and 'albums' in top_charts: items = listing.build_album_listitems(top_charts['albums']) listing.list_albums(items) else: listing.list_items([])
def search_albums(query): if query: result = GMUSIC.search(query) else: result = GMUSIC.search(cached=True) if result: items = listing.build_album_listitems(result['album_hits']) listing.list_albums(items)
def my_library_artist(artist_id): if artist_id: top_songs = xbmcgui.ListItem(utils.translate(30066)) top_songs.setArt({'thumb': thumbs.IMG_STAR, 'poster': thumbs.IMG_STAR}) related_artists = xbmcgui.ListItem(utils.translate(30067)) related_artists.setArt({ 'thumb': thumbs.IMG_ARTIST, 'poster': thumbs.IMG_ARTIST }) all_albums = xbmcgui.ListItem(utils.translate(30098)) all_albums.setArt({ 'thumb': thumbs.IMG_ALBUM, 'poster': thumbs.IMG_ALBUM }) items = [ (utils.build_url( url=URL, paths=['browse', 'artist', artist_id, 'top-songs'], r_path=True, r_query=True, ), top_songs, True), (utils.build_url( url=URL, paths=['browse', 'artist', artist_id, 'related-artists'], r_path=True, r_query=True, ), related_artists, True), (utils.build_url( url=URL, paths=['browse', 'artist', artist_id], r_path=True, r_query=True, ), all_albums, True), ] albums = GMUSIC.get_user_artist_albums(artist_id=artist_id) albums.sort(key=itemgetter('name')) albums.sort(key=itemgetter('year'), reverse=True) items += listing.build_album_listitems(albums, True) listing.list_albums(items)
def listen_now_albums(): listen_now = gmusic.get_listen_now_items() albums = [] for item in listen_now: # 1 = album # 2 = playlist # 3 = radio if item['type'] != '1': continue album = item['album'] if 'id' not in album and 'metajamCompactKey' not in album['id']: continue album_title = '' if 'title' in album: album_title = album['title'] album_artist = None if 'artist_name' in album: album_artist = album['artist_name'] album_art = None if 'images' in item and len(item['images']) > 0: album_art = item['images'][0]['url'] albums.append({ 'albumId': album['id']['metajamCompactKey'], 'name': album_title, 'albumArtist': album_artist, 'albumArtRef': album_art }) items = listing.build_album_listitems(albums) listing.list_albums(items)
def my_library_genre(genre): albums = GMUSIC.get_user_genre_albums(genre=genre) items = listing.build_album_listitems(albums, True) listing.list_albums(items)
def my_library_albums(): albums = GMUSIC.get_my_library_albums() items = listing.build_album_listitems(albums, True) listing.list_albums(items)