X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fclient.py;h=80c16e530875a2b6fd68fcff717568bbb339e96d;hb=ab9952e0258426133f6bb0fe6395ec7464dfdd33;hp=929f66281fd7489cc2d001a75efa5755e3ffe138;hpb=c660efb577c11bde6229d37550bf197fa6bae3e4;p=mpd-sima.git diff --git a/sima/client.py b/sima/client.py index 929f662..80c16e5 100644 --- a/sima/client.py +++ b/sima/client.py @@ -22,7 +22,6 @@ except ImportError as err: from .lib.player import Player from .lib.track import Track from .lib.simastr import SimaStr -from .utils.leven import levenshtein_ratio class PlayerError(Exception): @@ -151,21 +150,14 @@ class PlayerClient(Player): matching_artists.append(fuzz_art) self.log.debug('"%s" matches "%s".' % (fuzz_art, artist)) return matching_artists - # Proceed with levenshtein and SimaStr - leven = levenshtein_ratio(artist.stripped.lower(), - SimaStr(fuzz_art).stripped.lower()) - # SimaStr string __eq__, not regular string comparison here + # SimaStr string __eq__ (not regular string comparison here) if artist == fuzz_art: matching_artists.append(fuzz_art) self.log.info('"%s" quite probably matches "%s" (SimaStr)' % (fuzz_art, artist)) - elif leven >= 0.82: # PARAM - matching_artists.append(fuzz_art) - self.log.debug('FZZZ: "%s" should match "%s" (lr=%1.3f)' % - (fuzz_art, artist, leven)) else: - self.log.debug('FZZZ: "%s" does not match "%s" (lr=%1.3f)' % - (fuzz_art, artist, leven)) + self.log.debug('FZZZ: "%s" does not match "%s"' % + (fuzz_art, artist)) return matching_artists def find_album(self, artist, album): @@ -178,6 +170,16 @@ class PlayerClient(Player): return alb_art_search return self.find('artist', artist, 'album', album) + def find_albums(self, artist): + """ + Special wrapper around album search: + Album lookup is made through AlbumArtist/Album instead of Artist/Album + """ + alb_art_search = self.list('album', 'albumartist', artist,) + if alb_art_search: + return alb_art_search + return self.list('album', 'artist', artist) + def monitor(self): curr = self.current try: