From: kaliko <kaliko@azylum.org>
Date: Sun, 10 May 2020 14:22:50 +0000 (+0200)
Subject: Revert "Fixed MPD client album search"
X-Git-Tag: 0.16.0.dev0~20
X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=f44e969776db0a8716040a45de69bbf6508785a1;p=mpd-sima.git

Revert "Fixed MPD client album search"

This reverts commit 5f1dd8bdf50cd25c049e5c20742be87b461e6385.
---

diff --git a/sima/mpdclient.py b/sima/mpdclient.py
index afc51dc..50b3010 100644
--- a/sima/mpdclient.py
+++ b/sima/mpdclient.py
@@ -309,29 +309,28 @@ class MPD(MPDClient):
 
     def _find_art(self, artist):
         tracks = set()
-        if self.use_mbid and artist.mbid:
+        if artist.mbid:
             tracks |= set(self.find('musicbrainz_artistid', artist.mbid))
         for name in artist.names:
             tracks |= set(self.find('artist', name))
         return list(tracks)
 
     def _find_alb(self, album):
+        albums = set()
         if album.mbid and self.use_mbid:
             filt = f'(MUSICBRAINZ_ALBUMID == {album.mbid})'
-            return self.find(filt)
+            albums |= set(self.find(filt))
         # Now look for album with no MusicBrainzIdentifier
         if album.artist.mbid and self.use_mbid:  # Use album artist MBID if possible
             filt = f"((MUSICBRAINZ_ALBUMARTISTID == '{album.artist.mbid}') AND (album == '{album!s}'))"
-            return self.find(filt)
-        tracks = []
-        # Falls back to albumartist/album name
-        filt = f"((albumartist == '{album.artist!s}') AND (album == '{album!s}'))"
-        tracks = self.find(filt)
-        # Falls back to artist/album name
-        if not tracks:
+            albums |= set(self.find(filt))
+        if not albums:  # Falls back to albumartist/album name
+            filt = f"((albumartist == '{album.artist!s}') AND (album == '{album!s}'))"
+            albums |= set(self.find(filt))
+        if not albums:  # Falls back to artist/album name
             filt = f"((artist == '{album.artist!s}') AND (album == '{album!s}'))"
-            tracks = self.find(filt)
-        return tracks
+            albums |= set(self.find(filt))
+        return list(albums)
 # #### / find_tracks ##
 
 # #### Search Methods #####