'Returns an AlbumInfo object for a discogs Release object.'

def get_album_info(self, result):

    if (not result.data.get('artists')):
        result.refresh()
    if (not all([result.data.get(k) for k in ['artists', 'title', 'id', 'tracklist']])):
        self._log.warn(u'Release    does    not    contain    the    required    fields')
        return None
    (artist, artist_id) = self.get_artist([a.data for a in result.artists])
    album = re.sub('    +', '    ', result.title)
    album_id = result.data['id']
    tracks = self.get_tracks(result.data['tracklist'])
    va = (result.data['artists'][0].get('name', '').lower() == 'various')
    year = result.data.get('year')
    mediums = len(set((t.medium for t in tracks)))
    country = result.data.get('country')
    data_url = result.data.get('uri')
    albumtype = media = label = catalogno = None
    if result.data.get('formats'):
        albumtype = (',    '.join(result.data['formats'][0].get('descriptions', [])) or None)
        media = result.data['formats'][0]['name']
    if result.data.get('labels'):
        label = result.data['labels'][0].get('name')
        catalogno = result.data['labels'][0].get('catno')
    if va:
        artist = config['va_name'].as_str()
    if (catalogno == 'none'):
        catalogno = None
    for track in tracks:
        track.media = media
        track.medium_total = mediums
    return AlbumInfo(album, album_id, artist, artist_id, tracks, asin=None, albumtype=albumtype, va=va, year=year, month=None, day=None, label=label, mediums=mediums, artist_sort=None, releasegroup_id=None, catalognum=catalogno, script=None, language=None, country=country, albumstatus=None, media=media, albumdisambig=None, artist_credit=None, original_year=None, original_month=None, original_day=None, data_source='Discogs', data_url=data_url)
