fix(worker): prefer the original release-group over same-titled reissues
The real root cause of "Hybrid Theory" re-downloading forever: MB lists the 2000 original and a 2023 reissue as SEPARATE same-titled Album release-groups. They tie on (artist, title, is_album), so _best_release_group kept whichever MB relevance-ordered first — the 2023 reissue (13 tracks / ~52 min). Its inflated tracklist+runtime then failed the completeness/duration checks against the standard 12-track album sources deliver, looping endlessly. Add an earliest-first-release-date tie-break so the original group wins. (Complements _pick_release, which handles reissue releases *within* a group.) 335 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,21 @@ def test_empty_groups_returns_none():
|
||||
assert _best_release_group("Michael Jackson", "Off the Wall", []) is None
|
||||
|
||||
|
||||
def test_prefers_original_group_over_later_reissue():
|
||||
# Real "Hybrid Theory" bug: MB lists a 2000 original and a 2023 reissue as separate same-titled
|
||||
# Album groups (tie on artist/title/type). The reissue's longer tracklist fails completeness
|
||||
# checks, so the original (earliest) must win regardless of MB's relevance order.
|
||||
groups = [
|
||||
{"id": "reissue", "title": "Hybrid Theory", "primary-type": "Album",
|
||||
"first-release-date": "2023-07-21",
|
||||
"artist-credit": [{"artist": {"name": "Linkin Park"}}]},
|
||||
{"id": "original", "title": "Hybrid Theory", "primary-type": "Album",
|
||||
"first-release-date": "2000-10-24",
|
||||
"artist-credit": [{"artist": {"name": "Linkin Park"}}]},
|
||||
]
|
||||
assert _best_release_group("Linkin Park", "Hybrid Theory", groups)["id"] == "original"
|
||||
|
||||
|
||||
def test_prefers_credited_artist_over_same_titled_other_artist_album():
|
||||
# Real-world "Fun Machine" bug: Lake Street Dive's EP is what we followed, but two
|
||||
# unrelated bands also have a release group literally titled "Fun Machine" as an Album.
|
||||
|
||||
Reference in New Issue
Block a user