]> kaliko git repositories - mpd-sima.git/commitdiff
Add "Various Artist" filter in albums search
authorkaliko <efrim@azylum.org>
Sun, 16 Feb 2014 00:24:27 +0000 (01:24 +0100)
committerkaliko <efrim@azylum.org>
Sun, 16 Feb 2014 00:24:27 +0000 (01:24 +0100)
sima/client.py

index ff6ca38197624edddcb212b30d975c3bfb500e8f..2892d5e4ae82b24a6a244281359237bc97f199c4 100644 (file)
@@ -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):