mirror of
https://github.com/beetbox/beets.git
synced 2025-12-11 11:07:31 +01:00
lastgenre: Automatically retry asciified lookups if the initial lookup fails.
This commit is contained in:
parent
c227501a5d
commit
c7b6f75ca8
2 changed files with 6 additions and 9 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
----------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue