diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index e532543a2..216f7efee 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -174,6 +174,21 @@ def correct_list_fields(m: LibModel) -> None: if hasattr(m, "mb_albumartistids"): ensure_first_value("mb_albumartistid", "mb_albumartistids") + if hasattr(m, "artists_sort"): + ensure_first_value("artist_sort", "artists_sort") + + if hasattr(m, "artists_credit"): + ensure_first_value("artist_credit", "artists_credit") + + if hasattr(m, "albumartists_credit"): + ensure_first_value("albumartist_credit", "albumartists_credit") + + if hasattr(m, "artists"): + ensure_first_value("artist", "artists") + + if hasattr(m, "albumartists_sort"): + ensure_first_value("albumartist_sort", "albumartists_sort") + def apply_item_metadata(item: Item, track_info: TrackInfo): """Set an item's metadata from its matched TrackInfo object.""" diff --git a/test/test_autotag.py b/test/test_autotag.py index f2ed5e416..03fc9d6f0 100644 --- a/test/test_autotag.py +++ b/test/test_autotag.py @@ -172,13 +172,14 @@ class ApplyTest(TestCase): common_expected = { "album": "album", "albumartist_credit": "albumArtistCredit", - "albumartist_sort": "", "albumartist": "albumArtist", "albumartists": ["albumArtist", "albumArtist2"], "albumartists_credit": [ + "albumArtistCredit", "albumArtistCredit1", "albumArtistCredit2", ], + "albumartist_sort": "albumArtistSort", "albumartists_sort": ["albumArtistSort", "albumArtistSort2"], "albumtype": "album", "albumtypes": ["album"], @@ -199,7 +200,7 @@ class ApplyTest(TestCase): { **common_expected, "artist": "trackArtist", - "artists": ["albumArtist", "albumArtist2"], + "artists": ["trackArtist", "albumArtist", "albumArtist2"], "artist_credit": "trackArtistCredit", "artist_sort": "trackArtistSort", "artists_credit": ["trackArtistCredit"], @@ -214,8 +215,9 @@ class ApplyTest(TestCase): "artist": "albumArtist", "artists": ["albumArtist", "albumArtist2"], "artist_credit": "albumArtistCredit", - "artist_sort": "", + "artist_sort": "albumArtistSort", "artists_credit": [ + "albumArtistCredit", "albumArtistCredit1", "albumArtistCredit2", ],