From c7b6f75ca8c95b7b547bde9a3d5bb39c53f0bcff Mon Sep 17 00:00:00 2001 From: David Logie Date: Sun, 21 Dec 2014 12:58:15 +0000 Subject: [PATCH] lastgenre: Automatically retry asciified lookups if the initial lookup fails. --- beetsplug/lastgenre/__init__.py | 12 ++++++------ docs/plugins/lastgenre.rst | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 2d502e076..7937db277 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -135,7 +135,6 @@ class LastGenrePlugin(plugins.BeetsPlugin): 'force': True, 'auto': True, 'separator': u', ', - 'asciify': False, }) self.setup() @@ -247,15 +246,16 @@ class LastGenrePlugin(plugins.BeetsPlugin): if any(not s for s in args): return None - if self.config['asciify']: - args = [unidecode(arg) for arg in args] - key = u'{0}.{1}'.format(entity, u'-'.join(unicode(a) for a in args)) if key in self._genre_cache: return self._genre_cache[key] else: - genre = self.fetch_genre(method(*args)) - self._genre_cache[key] = genre + args_ascii = [unidecode(arg) for arg in args] + for arglist in [args, args_ascii]: + genre = self.fetch_genre(method(*arglist)) + self._genre_cache[key] = genre + if genre: + break return genre def fetch_album_genre(self, obj): diff --git a/docs/plugins/lastgenre.rst b/docs/plugins/lastgenre.rst index d874a4a72..9d3242467 100644 --- a/docs/plugins/lastgenre.rst +++ b/docs/plugins/lastgenre.rst @@ -108,9 +108,6 @@ configuration file. The available options are: - **whitelist**: The filename of a custom genre list, ``yes`` to use the internal whitelist, or ``no`` to consider all genres valid. Default: ``yes``. -- **asciify**: Convert all non-ASCII characters to ASCII equivalents - when performing lookups. - Default: ``no``. Running Manually ----------------