From 0e3f6cb09dfc10f813feae861fa41d942ca77290 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 23 Apr 2015 15:25:47 -0700 Subject: [PATCH] Provide Unicode to Jellyfish 0.5.0 The new version requires arguments are Unicode. We were providing ASCII byte strings, produced by Unidecode. We now re-decode this back to Unicode before passing to the Levenshtein function. --- beets/autotag/hooks.py | 6 ++++-- docs/changelog.rst | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index fa2dad9d6..5c4ce082e 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -203,8 +203,10 @@ def _string_dist_basic(str1, str2): transliteration/lowering to ASCII characters. Normalized by string length. """ - str1 = unidecode(str1) - str2 = unidecode(str2) + assert isinstance(str1, unicode) + assert isinstance(str2, unicode) + str1 = unidecode(str1).decode('ascii') + str2 = unidecode(str2).decode('ascii') str1 = re.sub(r'[^a-z0-9]', '', str1.lower()) str2 = re.sub(r'[^a-z0-9]', '', str2.lower()) if not str1 and not str2: diff --git a/docs/changelog.rst b/docs/changelog.rst index 4032d6155..43d9410b8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,6 +10,7 @@ Fixes: respects the ``write`` config option under ``import``. If this is disabled, album art is no longer embedded on import in order to leave files untouched---in effect, ``auto`` is implicitly disabled. :bug:`1427` +* Fix compatibility with `Jellyfish`_ version 0.5.0. 1.3.12 (April 18, 2015)