def getTopTags(artist, album, autocorrect=1): result = query('album.gettoptags', { 'artist': artist, 'album': album, 'autocorrect': autocorrect }) return [Tag(t) for t in result.get('toptags', {}).get('tag', [])]
def search(album, limit=50, page=1): return AlbumResults( query('album.search', { 'album': album, 'page': page, 'limit': limit }).get('results', {}))
def getBuyLinks(artist, album, autocorrect=1, country='united states'): result = query( 'album.getbuylinks', { 'artist': artist, 'album': album, 'autocorrect': autocorrect, 'country': country }) affiliations = [] for k, v in result.get('affiliations', {}).items(): affiliations.extend([Affiliation(a, k) for a in v]) return affiliations
def getBuyLinks(artist, album, autocorrect=1, country='united states'): result = query('album.getbuylinks', {'artist': artist, 'album':album, 'autocorrect':autocorrect, 'country':country}) affiliations = [] for k, v in result.get('affiliations', {}).items(): affiliations.extend([Affiliation(a, k) for a in v]) return affiliations
def getTopTracks(artist, limit=50, page=1, autocorrect=1): result = query('artist.gettoptracks', {'artist': artist, 'limit': limit, 'page': page, 'autocorrect': autocorrect}) return [Track(t) for t in result.get('toptracks', {}).get('track', [])]
def getSimilar(artist, limit=50, autocorrect=1): result = query('artist.getsimilar', {'artist':artist, 'limit':limit, 'autocorrect':autocorrect}) return [Artist(e) for e in result.get('similarartists', {}).get('artist', [])]
def getEvents(artist, limit=50, page=1, autocorrect=1, festivalsonly=0): result = query('artist.getevents', {'artist':artist, 'autocorrect':1, 'limit':limit, 'page':page, 'festivalsonly':festivalsonly}) return [Event(e) for e in result.get('events', {}).get('event', [])]
def search(artist, limit=50, page=1): '''Search for artists by the provided name''' return ArtistResults(query('artist.search', {'artist': artist, 'page':page, 'limit': limit}).get('results', {}))
def search(track, artist=None, page=1, limit=30): '''Search for tracks by the provided name''' params = {'track': track, 'page':page, 'limit': limit} if artist: params['artist'] = artist return TrackResults(query('track.search', params).get('results', {}))
def getCorrection(artist): """Get the name correction for the provided artist""" result = query("artist.getcorrection", {"artist": artist}) return [Artist(a.get("artist", {})) for a in result.get("corrections", {}).get("correction", [])]
def search(artist, limit=50, page=1): """Search for artists by the provided name""" return ArtistResults( query("artist.search", {"artist": artist, "page": page, "limit": limit}).get("results", {}) )
def get(artist, autocorrect=1, lang="en"): result = query("artist.getinfo", {"artist": artist, "autocorrect": autocorrect, "lang": lang}) return Artist(result.get("artist", {}))
def top(limit=50, page=1): result = query("chart.gettopartists", {"limit": limit, "page": page}) return [Artist(a) for a in result.get("artists", {}).get("artist", [])]
def getTopTracks(artist, limit=50, page=1, autocorrect=1): result = query( "artist.gettoptracks", {"artist": artist, "limit": limit, "page": page, "autocorrect": autocorrect} ) return [Track(t) for t in result.get("toptracks", {}).get("track", [])]
def getTopTags(artist, album, autocorrect=1): result = query('album.gettoptags', {'artist':artist, 'album':album, 'autocorrect':autocorrect}) return [Tag(t) for t in result.get('toptags', {}).get('tag', [])]
def search(track, artist=None, page=1, limit=30): '''Search for tracks by the provided name''' params = {'track': track, 'page': page, 'limit': limit} if artist: params['artist'] = artist return TrackResults(query('track.search', params).get('results', {}))
def getEvents(artist, limit=50, page=1, autocorrect=1, festivalsonly=0): result = query( "artist.getevents", {"artist": artist, "autocorrect": 1, "limit": limit, "page": page, "festivalsonly": festivalsonly}, ) return [Event(e) for e in result.get("events", {}).get("event", [])]
def get(artist, autocorrect=1, lang='en'): result = query('artist.getinfo', {'artist':artist, 'autocorrect':autocorrect, 'lang':lang}) return Artist(result.get('artist', {}))
def getImages(artist, limit=50, page=1, autocorrect=1, order="popularity"): result = query( "artist.getimages", {"artist": artist, "limit": limit, "page": page, "autocorrect": autocorrect, "order": order}, ) return [Image(i) for i in result.get("images", {}).get("image", [])]
def getCorrection(artist): '''Get the name correction for the provided artist''' result = query('artist.getcorrection', {'artist': artist}) return [Artist(a.get('artist', {})) for a in result.get('corrections', {}).get('correction', [])]
def getSimilar(artist, limit=50, autocorrect=1): result = query("artist.getsimilar", {"artist": artist, "limit": limit, "autocorrect": autocorrect}) return [Artist(e) for e in result.get("similarartists", {}).get("artist", [])]
def getImages(artist, limit=50, page=1, autocorrect=1, order='popularity'): result = query('artist.getimages', {'artist':artist, 'limit':limit, 'page':page, 'autocorrect':autocorrect, 'order':order}) return [Image(i) for i in result.get('images', {}).get('image', [])]
def getTopAlbums(artist, limit=50, page=1, autocorrect=1): result = query( "artist.gettopalbums", {"artist": artist, "limit": limit, "page": page, "autocorrect": autocorrect} ) return [Album(a) for a in result.get("topalbums", {}).get("album", [])]
def getTopAlbums(artist, limit=50, page=1, autocorrect=1): result = query('artist.gettopalbums', {'artist':artist, 'limit':limit, 'page':page, 'autocorrect':autocorrect}) return [Album(a) for a in result.get('topalbums', {}).get('album', [])]
def getTopTags(artist, autocorrect=1): result = query("artist.gettoptags", {"artist": artist, "autocorrect": autocorrect}) return [Tag(t) for t in result.get("toptags", {}).get("tag", [])]
def top(limit=50, page=1): result = query('chart.gettopartists', {'limit':limit, 'page':page}) return [Artist(a) for a in result.get('artists', {}).get('artist', [])]
def search(album, limit=50, page=1): return AlbumResults(query('album.search', {'album':album, 'page':page, 'limit': limit}).get('results', {}))