From: kaliko Date: Sun, 16 Feb 2014 00:24:27 +0000 (+0100) Subject: Add "Various Artist" filter in albums search X-Git-Tag: mpd-sima/0.12.0pr4~19 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=7a910ce647cc646dc7ca8adbc69e1f0e725761fc;p=mpd-sima.git Add "Various Artist" filter in albums search --- diff --git a/sima/client.py b/sima/client.py index ff6ca38..2892d5e 100644 --- a/sima/client.py +++ b/sima/client.py @@ -241,8 +241,13 @@ class PlayerClient(Player): if album not in albums: albums.append(Album(name=album, **kwalbart)) for album in self.list('album', 'artist', artist): - arts = set([trk.artist for trk in self.find('album', album)]) - if len(arts) < 2: # TODO: better heuristic, use a ratio instead + album_trks = [trk for trk in self.find('album', album)] + # TODO: add a VA filter option + if 'Various Artists' in [tr.albumartist for tr in album_trks]: + self.log.debug('Discarding {0} ("Various Artists" set)'.format(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, albumartist=artist)) elif (album and album not in albums):