mirror of
https://github.com/beetbox/beets.git
synced 2025-12-22 08:34:23 +01:00
initial changes, changelog adjusted, TODO: test for various artists and update docs
This commit is contained in:
parent
23e46315e3
commit
24fbc566f6
3 changed files with 63 additions and 1 deletions
|
|
@ -76,6 +76,8 @@ TRACK_INDEX_RE = re.compile(
|
|||
re.VERBOSE,
|
||||
)
|
||||
|
||||
DISAMBIGUATION_RE = re.compile(r" \(\d+\)$")
|
||||
|
||||
|
||||
class ReleaseFormat(TypedDict):
|
||||
name: str
|
||||
|
|
@ -96,6 +98,7 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
"separator": ", ",
|
||||
"index_tracks": False,
|
||||
"append_style_genre": False,
|
||||
"strip_disambiguation": True,
|
||||
}
|
||||
)
|
||||
self.config["apikey"].redact = True
|
||||
|
|
@ -373,6 +376,12 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
artist = config["va_name"].as_str()
|
||||
if catalogno == "none":
|
||||
catalogno = None
|
||||
|
||||
# Remove Discogs specific artist disambiguation 'Artist (2)' or 'Label (3)'
|
||||
if self.config["strip_disambiguation"]:
|
||||
artist = DISAMBIGUATION_RE.sub("", artist)
|
||||
if label is not None:
|
||||
label = DISAMBIGUATION_RE.sub("", label)
|
||||
# Explicitly set the `media` for the tracks, since it is expected by
|
||||
# `autotag.apply_metadata`, and set `medium_total`.
|
||||
for track in tracks:
|
||||
|
|
|
|||
|
|
@ -18,17 +18,21 @@ Bug fixes:
|
|||
- :doc:`plugins/spotify` Removed old and undocumented config options
|
||||
`artist_field`, `album_field` and `track` that were causing issues with track
|
||||
matching. :bug:`5189`
|
||||
- :doc:`plugins/discogs` Added config option `strip_disambiguation` to allow choice of removing discogs numeric disambiguation :bug:`5366`
|
||||
- :doc:`plugins/discogs` Fixed inconsistency in stripping disambiguation from artists but not labels :bug:`5366`
|
||||
|
||||
For packagers:
|
||||
|
||||
Other changes:
|
||||
- :class:`beets.metadata_plugin.MetadataSourcePlugin`: Remove discogs specific disambiguation stripping
|
||||
|
||||
- :doc:`plugins/index`: Clarify that musicbrainz must be mentioned if plugin
|
||||
list modified :bug:`6020`
|
||||
- :doc:`/faq`: Add check for musicbrainz plugin if auto-tagger can't find a
|
||||
match :bug:`6020`
|
||||
- :doc:`guides/tagger`: Section on no matching release found, related to
|
||||
possibly disabled musicbrainz plugin :bug:`6020`
|
||||
- :class:`beets.metadata_plugin.MetadataSourcePlugin`: Remove discogs specific
|
||||
disambiguation stripping
|
||||
|
||||
2.4.0 (September 13, 2025)
|
||||
--------------------------
|
||||
|
|
|
|||
|
|
@ -374,6 +374,55 @@ class DGAlbumInfoTest(BeetsTestCase):
|
|||
assert d.genre == "GENRE1, GENRE2"
|
||||
assert d.style is None
|
||||
|
||||
def test_strip_disambiguation_label_artist(self):
|
||||
"""Test removing discogs disambiguation"""
|
||||
data = {
|
||||
"id": 123,
|
||||
"uri": "https://www.discogs.com/release/123456-something",
|
||||
"tracklist": [self._make_track("A", "1", "01:01")],
|
||||
"artists": [{"name": "ARTIST NAME (2)", "id": 321, "join": ""}],
|
||||
"title": "TITLE",
|
||||
"labels": [
|
||||
{
|
||||
"name": "LABEL NAME (5)",
|
||||
"catno": "CATALOG NUMBER",
|
||||
}
|
||||
],
|
||||
}
|
||||
release = Bag(
|
||||
data=data,
|
||||
title=data["title"],
|
||||
artists=[Bag(data=d) for d in data["artists"]],
|
||||
)
|
||||
d = DiscogsPlugin().get_album_info(release)
|
||||
assert d.artist == "ARTIST NAME"
|
||||
assert d.label == "LABEL NAME"
|
||||
|
||||
def test_strip_disambiguation_off_label_artist(self):
|
||||
"""Test not removing discogs disambiguation"""
|
||||
data = {
|
||||
"id": 123,
|
||||
"uri": "https://www.discogs.com/release/123456-something",
|
||||
"tracklist": [self._make_track("A", "1", "01:01")],
|
||||
"artists": [{"name": "ARTIST NAME (2)", "id": 321, "join": ""}],
|
||||
"title": "TITLE",
|
||||
"labels": [
|
||||
{
|
||||
"name": "LABEL NAME (5)",
|
||||
"catno": "CATALOG NUMBER",
|
||||
}
|
||||
],
|
||||
}
|
||||
config["discogs"]["strip_disambiguation"] = False
|
||||
release = Bag(
|
||||
data=data,
|
||||
title=data["title"],
|
||||
artists=[Bag(data=d) for d in data["artists"]],
|
||||
)
|
||||
d = DiscogsPlugin().get_album_info(release)
|
||||
assert d.artist == "ARTIST NAME (2)"
|
||||
assert d.label == "LABEL NAME (5)"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"formats, expected_media, expected_albumtype",
|
||||
|
|
|
|||
Loading…
Reference in a new issue