summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8676187)
search_albums method was ignoring some albums when Artist object had aliases.
MPD_sima v0.15.3 UNRELEASED
* Improve HTTP client (use persistent connection)
MPD_sima v0.15.3 UNRELEASED
* Improve HTTP client (use persistent connection)
+ * Fixed a serious bug in PlayerClient().search_albums()
+ "search_albums" method was ignoring some albums when Artist object had
+ aliases.
-- kaliko jack <kaliko@azylum.org>
-- kaliko jack <kaliko@azylum.org>
def search_albums(self, artist):
"""
Fetch all albums for "AlbumArtist" == artist
def search_albums(self, artist):
"""
Fetch all albums for "AlbumArtist" == artist
- Filter albums returned for "artist" == artist since MPD returns any
- album containing at least a single track for artist
+ Then look for albums for "artist" == artist and try to filters
+ multi-artists albums
+
+ NB: Running "client.list('album', 'artist', name)" MPD returns any album
+ containing at least a track with "artist" == name
+ TODO: Use MusicBrainzID here cf. #30 @gitlab
"""
albums = []
for name in artist.names:
"""
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}
self.log.debug('Searching album for aliase: "%s"', name)
kwalbart = {'albumartist':name, 'artist':name}
- for album in self.list('album', 'albumartist', artist):
+ for album in self.list('album', 'albumartist', name):
if album and album not in albums:
albums.append(Album(name=album, **kwalbart))
if album and album not in albums:
albums.append(Album(name=album, **kwalbart))
- for album in self.list('album', 'artist', artist):
+ for album in self.list('album', 'artist', name):
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])
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])
+ # Avoid selecting album where artist is credited for a single
+ # track of the album
if len(set(arts)) < 2: # TODO: better heuristic, use a ratio instead
if album not in albums:
albums.append(Album(name=album, **kwalbart))
if len(set(arts)) < 2: # TODO: better heuristic, use a ratio instead
if album not in albums:
albums.append(Album(name=album, **kwalbart))