fix(lidarr): prefer own-artist studio album over various-artists comps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 23:30:15 -07:00
parent 1661cb1742
commit b99e5eb9cb
2 changed files with 32 additions and 7 deletions

View File

@@ -77,3 +77,20 @@ def test_first_artist_credit_only(monkeypatch):
monkeypatch.setattr(mf.time, "sleep", lambda *_: None)
out = mf.musicbrainz_best_album("SLVMLORD", "Under My Skin")
assert out["artist"] == "SLVMLORD"
def test_prefers_own_artist_studio_over_various_artists(monkeypatch):
# A studio-looking VA compilation dated earlier must NOT beat the artist's own album.
payload = {"recordings": [{"artist-credit": [{"name": "Daft Punk"}], "releases": [
{"date": "2001-10-26", "artist-credit": [{"name": "Various Artists"}],
"release-group": {"id": "va-mbid", "title": "All The Hits Now",
"primary-type": "Album", "secondary-types": []}},
{"date": "2002", "artist-credit": [{"name": "Daft Punk"}],
"release-group": {"id": "48117b90-a16e-34ca-a514-19c702df1158", "title": "Discovery",
"primary-type": "Album", "secondary-types": []}},
]}]}
monkeypatch.setattr(mf.requests, "get", lambda *a, **k: _FakeResp(payload))
monkeypatch.setattr(mf.time, "sleep", lambda *_: None)
out = mf.musicbrainz_best_album("Daft Punk", "Harder Better Faster Stronger")
assert out["album_title"] == "Discovery"
assert out["rg_mbid"] == "48117b90-a16e-34ca-a514-19c702df1158"