def get_artist_by_id(mbid): """Get artist with MusicBrainz ID. Args: mbid (uuid): MBID(gid) of the artist. Returns: Dictionary containing the artist information """ key = cache.gen_key(mbid) artist = cache.get(key) if not artist: artist = _get_artist_by_id(mbid) cache.set(key=key, val=artist, time=DEFAULT_CACHE_EXPIRATION) return artist_rel.process(artist)
def get_artist_by_id(mbid): """Get artist with MusicBrainz ID. Args: mbid (uuid): MBID(gid) of the artist. Returns: Dictionary containing the artist information """ key = cache.gen_key(mbid) artist = cache.get(key) if not artist: artist = fetch_multiple_artists( [mbid], includes=['artist-rels', 'url-rels'], ).get(mbid) cache.set(key=key, val=artist, time=DEFAULT_CACHE_EXPIRATION) return artist_rel.process(artist)
def get_artist_by_id(mbid): """Get artist with MusicBrainz ID. Args: mbid (uuid): MBID(gid) of the artist. Returns: Dictionary containing the artist information """ key = cache.gen_key('artist', mbid) artist = cache.get(key) if not artist: artist = db.get_artist_by_id( mbid, includes=['artist-rels', 'url-rels'], unknown_entities_for_missing=True, ) cache.set(key=key, val=artist, time=DEFAULT_CACHE_EXPIRATION) return artist_rel.process(artist)
def get_artist_by_id(id): """Get artist with the MusicBrainz ID. Returns: Artist object with the following includes: url-rels, artist-rels. """ key = cache.gen_key(id) artist = cache.get(key) if not artist: try: artist = musicbrainzngs.get_artist_by_id( id, ['url-rels', 'artist-rels']).get('artist') except ResponseError as e: if e.cause.code == 404: return None else: raise InternalServerError(e.cause.msg) cache.set(key=key, val=artist, time=DEFAULT_CACHE_EXPIRATION) return artist_rel.process(artist)
def get_artist_by_id(id): """Get artist with the MusicBrainz ID. Returns: Artist object with the following includes: url-rels, artist-rels. """ key = cache.gen_key(id) artist = cache.get(key) if not artist: try: artist = musicbrainzngs.get_artist_by_id(id, ['url-rels', 'artist-rels']).get('artist') except ResponseError as e: if e.cause.code == 404: return None else: raise InternalServerError(e.cause.msg) artist = artist_rel.process(artist) cache.set(key=key, val=artist, time=DEFAULT_CACHE_EXPIRATION) return artist