def station(station_id=None, station_name=None, artist_id=None, album_id=None, track_id=None, genre_id=None, curated_station_id=None, playlist_token=None): if not station_id: station_id = GMUSIC.create_station( name=station_name, artist_id=artist_id, album_id=album_id, track_id=track_id, genre_id=genre_id, curated_station_id=curated_station_id, playlist_token=playlist_token) if not station_id: utils.notify(utils.translate(30050), utils.translate(30051)) return tracks = GMUSIC.get_station_tracks(station_id=station_id, num_tracks=25) items = listing.build_song_listitems(tracks=tracks, station_id=station_id) listing.list_songs(items)
def top_charts_songs(): top_charts = GMUSIC.get_top_chart() if top_charts and 'tracks' in top_charts: items = listing.build_song_listitems(top_charts['tracks']) listing.list_songs(items) else: listing.list_items([])
def search_songs(query): if query: result = GMUSIC.search(query) else: result = GMUSIC.search(cached=True) if result: items = listing.build_song_listitems(result['song_hits']) listing.list_songs(items)
def album(album_id): album_info = GMUSIC.get_album_info(album_id=album_id) if album_info and 'tracks' in album_info: items = listing.build_song_listitems(album_info['tracks']) listing.list_songs(items) else: listing.list_items([])
def listen_now_shared_playlist(playlist_token): playlist_content = GMUSIC.get_shared_playlist_contents( share_token=playlist_token) tracks = [] for item in playlist_content: tracks.append(item['track']) items = listing.build_song_listitems(tracks) listing.list_songs(items)
def browse_stations_station(station_name, curated_station_id): station_id = GMUSIC.create_station( name=station_name, curated_station_id=curated_station_id) if not station_id: utils.notify(utils.translate(30050), utils.translate(30051)) return items = listing.build_song_listitems( GMUSIC.get_station_tracks(station_id=station_id, num_tracks=25)) listing.list_songs(items)
def artist_top_tracks(artist_id): artist = GMUSIC.get_artist_info(artist_id=artist_id, include_albums=False, max_top_tracks=100, max_rel_artist=0) if artist and 'topTracks' in artist: items = listing.build_song_listitems(artist['topTracks']) listing.list_songs(items) else: listing.list_items([])
def my_library_songs(): items = listing.build_song_listitems(tracks=GMUSIC.get_my_library_songs(), my_library=True) listing.list_songs(items)
def my_library_album(album_id): songs = GMUSIC.get_user_album_songs(album_id=album_id) items = listing.build_song_listitems(songs, my_library=True) listing.list_songs(items)