mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 17:16:07 +01:00
improve flexibility of use of anv on artist tracks
This commit is contained in:
parent
1e677d57c1
commit
dd57c0da2d
2 changed files with 18 additions and 7 deletions
|
|
@ -349,10 +349,10 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
return None
|
||||
|
||||
artist_data = [a.data for a in result.artists]
|
||||
album_artist, album_artist_id = self.get_artist(artist_data,
|
||||
self.config["album_artist_anv"])
|
||||
artist_credit, _ = self.get_artist(artist_data,
|
||||
self.config["artist_credit_anv"])
|
||||
album_artist, album_artist_id = self.get_artist(artist_data)
|
||||
album_artist_anv, _ = self.get_artist(artist_data, use_anv=True)
|
||||
artist_credit = album_artist_anv
|
||||
|
||||
album = re.sub(r" +", " ", result.title)
|
||||
album_id = result.data["id"]
|
||||
# Use `.data` to access the tracklist directly instead of the
|
||||
|
|
@ -360,7 +360,13 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
# information and leave us with skeleton `Artist` objects that will
|
||||
# each make an API call just to get the same data back.
|
||||
tracks = self.get_tracks(result.data["tracklist"],
|
||||
(album_artist, album_artist_id, artist_credit))
|
||||
(album_artist, album_artist_anv, album_artist_id))
|
||||
|
||||
# Assign ANV to the proper fields for tagging
|
||||
if not self.config["artist_credit_anv"]:
|
||||
artist_credit = album_artist
|
||||
if self.config["album_artist_anv"]:
|
||||
album_artist = album_artist_anv
|
||||
|
||||
# Extract information for the optional AlbumInfo fields, if possible.
|
||||
va = result.data["artists"][0].get("name", "").lower() == "various"
|
||||
|
|
@ -661,7 +667,12 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
):
|
||||
"""Returns a TrackInfo object for a discogs track."""
|
||||
|
||||
artist, artist_id, artist_credit = album_artist_data
|
||||
artist, artist_anv, artist_id = album_artist_data
|
||||
artist_credit = artist_anv
|
||||
if not self.config["artist_credit_anv"]:
|
||||
artist_credit = artist
|
||||
if self.config["track_artist_anv"]:
|
||||
artist = artist_anv
|
||||
|
||||
title = track["title"]
|
||||
if self.config["index_tracks"]:
|
||||
|
|
|
|||
|
|
@ -624,7 +624,7 @@ def test_parse_featured_artists(track, expected_artist):
|
|||
"""Tests the plugins ability to parse a featured artist.
|
||||
Initial check with one featured artist, two featured artists,
|
||||
and three. Ignores artists that are not listed as featured."""
|
||||
t = DiscogsPlugin().get_track_info(track, 1, 1, ("ARTIST", 2, "ARTIST CREDIT"))
|
||||
t = DiscogsPlugin().get_track_info(track, 1, 1, ("ARTIST", "ARTIST CREDIT", 2))
|
||||
assert t.artist == expected_artist
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue