]> kaliko git repositories - mpd-sima.git/blobdiff - sima/client.py
Fixed var-dir option in bash completion
[mpd-sima.git] / sima / client.py
index e171c0b1d6c1934d728470e649b06c104e486992..499250fccd2d04c01ad96fab717a9b5a79b6c13d 100644 (file)
@@ -169,17 +169,18 @@ class PlayerClient(Player):
     @blacklist(track=True)
     def find_track(self, artist, title=None):
         tracks = set()
-        for name in artist.names:
-            if title:
-                tracks |= set(self.find('artist', name, 'title', title))
-            else:
-                tracks |= set(self.find('artist', name))
         if artist.mbid:
             if title:
-                tracks |= set(self.find('musicbrainz_artistid', artist.mbid))
-            else:
                 tracks |= set(self.find('musicbrainz_artistid', artist.mbid,
                                         'title', title))
+            else:
+                tracks |= set(self.find('musicbrainz_artistid', artist.mbid))
+        else:
+            for name in artist.names:
+                if title:
+                    tracks |= set(self.find('artist', name, 'title', title))
+                else:
+                    tracks |= set(self.find('artist', name))
         return list(tracks)
 
     @bl_artist
@@ -206,9 +207,9 @@ class PlayerClient(Player):
         if artist.mbid:
             # we already performed a lookup on artists with mbid set
             # search through remaining artists
-            artists = self._cache.get('nombid_artists', [])
+            artists = self._cache.get('nombid_artists')
         else:
-            artists = self._cache.get('artists', [])
+            artists = self._cache.get('artists')
         match = get_close_matches(artist.name, artists, 50, 0.73)
         if not match and not found:
             return