def getArtist(artistid, extrasonly=False): with mb_lock: artist_dict = {} artist = None try: limit = 100 artist = musicbrainzngs.get_artist_by_id(artistid)['artist'] newRgs = None artist['release-group-list'] = [] while newRgs == None or len(newRgs) >= limit: newRgs = musicbrainzngs.browse_release_groups( artistid, release_type="album", offset=len(artist['release-group-list']), limit=limit)['release-group-list'] artist['release-group-list'] += newRgs except WebServiceError, e: logger.warn( 'Attempt to retrieve artist information from MusicBrainz failed for artistid: %s (%s)' % (artistid, str(e))) time.sleep(5) except Exception, e: pass
def getArtist(artistid, extrasonly=False): with mb_lock: artist_dict = {} artist = None try: limit = 200 artist = musicbrainzngs.get_artist_by_id(artistid)["artist"] newRgs = None artist["release-group-list"] = [] while newRgs == None or len(newRgs) >= limit: newRgs = musicbrainzngs.browse_release_groups( artistid, release_type="album", offset=len(artist["release-group-list"]), limit=limit )["release-group-list"] artist["release-group-list"] += newRgs except WebServiceError, e: logger.warn( "Attempt to retrieve artist information from MusicBrainz failed for artistid: %s (%s)" % (artistid, str(e)) ) time.sleep(5) except Exception, e: pass
extras = db_artist['Extras'] extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook"] includes = [] i = 1 for extra in extras_list: if str(i) in extras: includes.append(extra) i += 1 for include in includes: artist = None try: artist = musicbrainzngs.get_artist_by_id(artistid,includes=["releases","release-groups"],release_status=['official'],release_type=include)['artist'] except WebServiceError, e: logger.warn('Attempt to retrieve artist information from MusicBrainz failed for artistid: %s (%s)' % (artistid, str(e))) time.sleep(5) if not artist: continue for rg in artist['release-group-list']: releasegroups.append({ 'title': unicode(rg['title']), 'id': unicode(rg['id']), 'url': u"http://musicbrainz.org/release-group/" + rg['id'], 'type': unicode(rg['type']) }) artist_dict['releasegroups'] = releasegroups
includes = [] i = 1 for extra in extras_list: if str(i) in extras: includes.append(extra) i += 1 for include in includes: artist = None try: artist = musicbrainzngs.get_artist_by_id( artistid, includes=["releases", "release-groups"], release_status=['official'], release_type=include)['artist'] except WebServiceError, e: logger.warn( 'Attempt to retrieve artist information from MusicBrainz failed for artistid: %s (%s)' % (artistid, str(e))) time.sleep(5) if not artist: continue for rg in artist['release-group-list']: releasegroups.append({ 'title': unicode(rg['title']), 'id':
includes = [] i = 1 for extra in extras_list: if str(i) in extras: includes.append(extra) i += 1 for include in includes: artist = None try: artist = musicbrainzngs.get_artist_by_id( artistid, includes=["releases", "release-groups"], release_status=["official"], release_type=include, )["artist"] except WebServiceError, e: logger.warn( "Attempt to retrieve artist information from MusicBrainz failed for artistid: %s (%s)" % (artistid, str(e)) ) time.sleep(5) if not artist: continue for rg in artist["release-group-list"]: releasegroups.append( { "title": unicode(rg["title"]),