'Returns a list of AlbumInfo objects for a discogs search query.'

def get_albums(self, query):

    query = re.sub('(?u)\\W+', '    ', query).encode('ascii', 'replace')
    query = re.sub('(?i)\\b(CD|disc)\\s*\\d+', '', query)
    try:
        releases = self.discogs_client.search(query, type='release').page(1)
    except CONNECTION_ERRORS:
        self._log.debug(u'Communication    error    while    searching    for    {0!r}', query, exc_info=True)
        return []
    return [album for album in map(self.get_album_info, releases[:5]) if album]
