Skip to content

Commit 08531ee

Browse files
committed
autotag: do not sync joined artist to artists field
1 parent 6173fa7 commit 08531ee

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

beets/autotag/hooks.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ def correct_list_fields(input_data: JSONDict) -> JSONDict:
7070

7171
def ensure_first_value(single_field: str, list_field: str) -> None:
7272
"""Ensure the first ``list_field`` item is equal to ``single_field``."""
73-
single_val, list_val = data.get(single_field), data.get(list_field, [])
73+
single_val, list_val = (
74+
data.get(single_field) or "",
75+
data.get(list_field, []),
76+
)
77+
if single_val not in list_val and set(single_val.lower().split()) & set(
78+
map(str.lower, list_val)
79+
):
80+
return
81+
7482
if single_val:
7583
data[list_field] = unique_list([single_val, *list_val])
7684
elif list_val:

test/autotag/test_hooks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ def test_singleton(self, item, track_info, expected_item_artist):
258258
("1", ["1", "2"], ("1", ["1", "2"])),
259259
("1", ["2", "1"], ("1", ["1", "2"])),
260260
("1", ["2"], ("1", ["1", "2"])),
261+
("1 ft 2", ["1", "1 ft 2"], ("1 ft 2", ["1 ft 2", "1"])),
262+
("1 FT 2", ["1", "1 ft 2"], ("1 FT 2", ["1", "1 ft 2"])),
263+
("a", ["b", "A"], ("a", ["b", "A"])),
264+
("1 ft 2", ["2", "1"], ("1 ft 2", ["2", "1"])),
261265
],
262266
)
263267
def test_correct_list_fields(

0 commit comments

Comments
 (0)