autotag: fix list fields

This commit is contained in:
Šarūnas Nejus 2025-11-03 08:55:18 +00:00
parent 0fefe556bf
commit 750f466086
No known key found for this signature in database
2 changed files with 20 additions and 3 deletions

View file

@ -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."""

View file

@ -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",
],