mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 08:56:56 +01:00
lastgenre: Only replace a small set of unicode characters.
This commit is contained in:
parent
c7b6f75ca8
commit
d9673ef9b5
1 changed files with 11 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2013, Adrian Sampson.
|
||||
#
|
||||
|
|
@ -25,8 +26,6 @@ import pylast
|
|||
import os
|
||||
import yaml
|
||||
|
||||
from unidecode import unidecode
|
||||
|
||||
from beets import plugins
|
||||
from beets import ui
|
||||
from beets.util import normpath, plurality
|
||||
|
|
@ -43,6 +42,10 @@ PYLAST_EXCEPTIONS = (
|
|||
pylast.NetworkError,
|
||||
)
|
||||
|
||||
REPLACE = {
|
||||
u'‐': '-',
|
||||
}
|
||||
|
||||
|
||||
def deduplicate(seq):
|
||||
"""Remove duplicates from sequence wile preserving order.
|
||||
|
|
@ -250,7 +253,12 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
if key in self._genre_cache:
|
||||
return self._genre_cache[key]
|
||||
else:
|
||||
args_ascii = [unidecode(arg) for arg in args]
|
||||
args_ascii = []
|
||||
for arg in args:
|
||||
for k, v in REPLACE.items():
|
||||
arg = arg.replace(k, v)
|
||||
args_ascii.append(arg)
|
||||
|
||||
for arglist in [args, args_ascii]:
|
||||
genre = self.fetch_genre(method(*arglist))
|
||||
self._genre_cache[key] = genre
|
||||
|
|
|
|||
Loading…
Reference in a new issue