diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index c8ce43a1e..3dc962464 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -654,17 +654,17 @@ class DiscogsPlugin(MetadataSourcePlugin): if not artist: artist = album_artist artist_id = album_artist_id - artist = self.strip_disambiguation(artist) length = self.get_track_length(track["duration"]) # Add featured artists extraartists = track.get("extraartists", []) featured = [ artist["name"] for artist in extraartists - if artist["role"].find("Featuring") != -1 + if "Featuring" in artist["role"] ] if featured: artist = f"{artist} feat. {', '.join(featured)}" + artist = self.strip_disambiguation(artist) return TrackInfo( title=title, track_id=track_id, diff --git a/docs/changelog.rst b/docs/changelog.rst index 1ae13303e..34ead44af 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -15,6 +15,7 @@ New features: converted files. - :doc:`plugins/discogs`: New config option `strip_disambiguation` to toggle stripping discogs numeric disambiguation on artist and label fields. +- :doc:`plugins/discogs` Added support for featured artists. Bug fixes: @@ -27,8 +28,6 @@ Bug fixes: matching. :bug:`5189` - :doc:`plugins/discogs` Fixed inconsistency in stripping disambiguation from artists but not labels. :bug:`5366` -- :doc:`plugins/discogs` Fixed issue with ignoring featured artists in the - extraartists field. For packagers: diff --git a/test/plugins/test_discogs.py b/test/plugins/test_discogs.py index 562bda88f..3652c0a54 100644 --- a/test/plugins/test_discogs.py +++ b/test/plugins/test_discogs.py @@ -450,6 +450,7 @@ class DGAlbumInfoTest(BeetsTestCase): assert d.artist == "ARTIST NAME (2) & OTHER ARTIST (5)" assert d.tracks[0].artist == "TEST ARTIST (5)" assert d.label == "LABEL NAME (5)" + config["discogs"]["strip_disambiguation"] = True @pytest.mark.parametrize( @@ -461,48 +462,17 @@ class DGAlbumInfoTest(BeetsTestCase): "title": "track", "position": "1", "duration": "5:00", - "extraartists": [ - { - "name": "MUSICIAN", - "role": "Featuring", - } + "artists": [ + {"name": "NEW ARTIST", "tracks": "", "id": 11146}, + {"name": "VOCALIST", "tracks": "", "id": 344, "join": "&"}, ], - }, - "ARTIST feat. MUSICIAN", - ), - ( - { - "type_": "track", - "title": "track", - "position": "1", - "duration": "5:00", - "extraartists": [ - { - "name": "PERFORMER", - "role": "Other Role, Featuring", - }, - { - "name": "MUSICIAN", - "role": "Featuring", - }, - ], - }, - "ARTIST feat. PERFORMER, MUSICIAN", - ), - ( - { - "type_": "track", - "title": "track", - "position": "1", - "duration": "5:00", - "artists": [{"name": "NEW ARTIST", "tracks": "", "id": 11146}], "extraartists": [ { "name": "SOLOIST", "role": "Featuring", }, { - "name": "PERFORMER", + "name": "PERFORMER (1)", "role": "Other Role, Featuring", }, { @@ -511,11 +481,11 @@ class DGAlbumInfoTest(BeetsTestCase): }, { "name": "MUSICIAN", - "role": "Featuring", + "role": "Featuring [Uncredited]", }, ], }, - "NEW ARTIST feat. SOLOIST, PERFORMER, MUSICIAN", + "NEW ARTIST, VOCALIST feat. SOLOIST, PERFORMER, MUSICIAN", ), ], )