示例#1
0
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
示例#2
0
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
示例#3
0
            i = 1
            for extra in extras_list:
                if str(i) in extras:
                    includes.append(extra)
                i += 1

            for include in includes:

                mb_extras_list = []

                try:
                    limit = 200
                    newRgs = None
                    while newRgs == None or len(newRgs) >= limit:
                        newRgs = musicbrainzngs.browse_release_groups(artistid,release_type=include,offset=len(mb_extras_list),limit=limit)['release-group-list']
                        mb_extras_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)

                for rg in mb_extras_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
示例#4
0
            for extra in extras_list:
                if str(i) in extras:
                    includes.append(extra)
                i += 1

            for include in includes:

                mb_extras_list = []

                try:
                    limit = 200
                    newRgs = None
                    while newRgs == None or len(newRgs) >= limit:
                        newRgs = musicbrainzngs.browse_release_groups(
                            artistid,
                            release_type=include,
                            offset=len(mb_extras_list),
                            limit=limit)['release-group-list']
                        mb_extras_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)

                for rg in mb_extras_list:
                    releasegroups.append({
                        'title':
                        unicode(rg['title']),
                        'id':
                        unicode(rg['id']),