mirror of
https://github.com/beetbox/beets.git
synced 2025-12-20 15:43:58 +01:00
Support generators in MetadataSourcePlugin.get_artist method
This commit is contained in:
parent
1b0f49fc3b
commit
f1794e8709
1 changed files with 3 additions and 1 deletions
|
|
@ -685,6 +685,8 @@ class MetadataSourcePlugin(metaclass=abc.ABCMeta):
|
|||
"""
|
||||
artist_id = None
|
||||
artist_string = ""
|
||||
artists = list(artists) # In case a generator was passed.
|
||||
total = len(artists)
|
||||
for idx, artist in enumerate(artists):
|
||||
if not artist_id:
|
||||
artist_id = artist[id_key]
|
||||
|
|
@ -694,7 +696,7 @@ class MetadataSourcePlugin(metaclass=abc.ABCMeta):
|
|||
# Move articles to the front.
|
||||
name = re.sub(r'^(.*?), (a|an|the)$', r'\2 \1', name, flags=re.I)
|
||||
# Use a join keyword if requested and available.
|
||||
if idx < (len(artists) - 1): # Skip joining on last.
|
||||
if idx < (total - 1): # Skip joining on last.
|
||||
if join_key and artist.get(join_key, None):
|
||||
name += f" {artist[join_key]} "
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue