fix(reorganize): include MusicBrainz release IDs

This commit is contained in:
ragnarlotus 2026-06-25 22:54:43 +02:00
parent b4dde43b45
commit 528aedbdfe
2 changed files with 25 additions and 0 deletions

View file

@ -100,6 +100,7 @@ _ALBUM_ID_COLUMNS = {
'deezer': 'deezer_id',
'discogs': 'discogs_id',
'hydrabase': 'soul_id',
'musicbrainz': 'musicbrainz_release_id',
}
# Human-facing label for each source.

View file

@ -73,3 +73,27 @@ def test_no_canonical_unchanged(monkeypatch):
album_data = {"spotify_album_id": "sp1"}
source, _, _ = lr._resolve_source(album_data, "spotify")
assert source == "spotify"
def test_musicbrainz_release_id_is_used_by_priority_walk(monkeypatch):
_patch_fetch(monkeypatch, {
('musicbrainz', 'mb-release-1'): [{'name': 'x'}],
})
monkeypatch.setattr(
lr,
'get_source_priority',
lambda primary: ['musicbrainz', 'spotify'],
)
album_data = {
'musicbrainz_release_id': 'mb-release-1',
}
source, api_album, items = lr._resolve_source(
album_data,
'musicbrainz',
)
assert source == 'musicbrainz'
assert api_album == {'name': 'musicbrainz:mb-release-1'}
assert items == [{'name': 'x'}]