- albums = set()
- albums.update(self.list('album', 'albumartist', artist))
- for album in self.list('album', 'artist', artist):
- arts = set([trk.artist for trk in self.find('album', album)])
- if len(arts) < 2:
- albums.add(album)
- else:
- self.log.debug('"{0}" probably not an album of "{1}"'.format(
- album, artist) + '({0})'.format('/'.join(arts)))
- if albums:
- self.log.debug('Albums candidate: {0}'.format('/'.join(albums)))
+ albums = []
+ for name in artist.names:
+ if len(artist.names) > 1:
+ self.log.debug('Searching album for aliase: "%s"', name)
+ kwalbart = {'albumartist':name, 'artist':name}
+ for album in self.list('album', 'albumartist', artist):
+ if album and album not in albums:
+ albums.append(Album(name=album, **kwalbart))
+ for album in self.list('album', 'artist', artist):
+ album_trks = [trk for trk in self.find('album', album)]
+ if 'Various Artists' in [tr.albumartist for tr in album_trks]:
+ self.log.debug('Discarding %s ("Various Artists" set)', album)
+ continue
+ arts = set([trk.artist for trk in album_trks])
+ if len(set(arts)) < 2: # TODO: better heuristic, use a ratio instead
+ if album not in albums:
+ albums.append(Album(name=album, **kwalbart))
+ elif album and album not in albums:
+ self.log.debug('"{0}" probably not an album of "{1}"'.format(
+ album, artist) + '({0})'.format('/'.join(arts)))