]> kaliko git repositories - mpd-sima.git/blobdiff - sima/mpdclient.py
Revert "Fixed MPD client album search"
[mpd-sima.git] / sima / mpdclient.py
index 13aa0b01c3cca749c922d8cfc0f6ba61309b2e85..50b30105c87875202ddb70363411f9cd8d2274de 100644 (file)
@@ -249,8 +249,10 @@ class MPD(MPDClient):
         if isinstance(payload, Track):
             super().__getattr__('add')(payload.file)
         elif isinstance(payload, list):
+            self.command_list_ok_begin()
             for tr in payload:  # TODO: use send command here
                 self.add(tr)
+            results = client.command_list_end()
         else:
             self.log.error('Cannot add %s', payload)
 
@@ -307,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 #####