mirror of
https://github.com/beetbox/beets.git
synced 2025-12-13 03:52:24 +01:00
Only use primary artist aliases. Fixes #632.
MusicBrainz will send down various artist aliases that may not be the primary (e.g. the previous name for a group). Only use an alias for the artist if it is the primary alias in one of the import locales.
This commit is contained in:
parent
b2cb87aa6d
commit
ebcd540e58
1 changed files with 3 additions and 10 deletions
|
|
@ -80,20 +80,13 @@ def _preferred_alias(aliases):
|
|||
|
||||
# Search configured locales in order.
|
||||
for locale in config['import']['languages'].as_str_seq():
|
||||
# Find matching aliases for this locale.
|
||||
matches = [a for a in aliases if a['locale'] == locale]
|
||||
# Find matching primary aliases for this locale.
|
||||
matches = [a for a in aliases if a['locale'] == locale and 'primary' in a]
|
||||
# Skip to the next locale if we have no matches
|
||||
if not matches:
|
||||
continue
|
||||
|
||||
# Find the aliases that have the primary flag set.
|
||||
primaries = [a for a in matches if 'primary' in a]
|
||||
# Take the primary if we have it, otherwise take the first
|
||||
# match with the correct locale.
|
||||
if primaries:
|
||||
return primaries[0]
|
||||
else:
|
||||
return matches[0]
|
||||
return matches[0]
|
||||
|
||||
def _flatten_artist_credit(credit):
|
||||
"""Given a list representing an ``artist-credit`` block, flatten the
|
||||
|
|
|
|||
Loading…
Reference in a new issue