Skip to content

Commit 54cbcc4

Browse files
committed
Assume that an empty list is an empty field
1 parent 498ea7e commit 54cbcc4

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

beets/autotag/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _apply_metadata(
127127

128128
# Don't overwrite fields with empty values unless the
129129
# field is explicitly allowed to be overwritten.
130-
if value is None and field not in nullable_fields:
130+
if (value is None or value == []) and field not in nullable_fields:
131131
continue
132132

133133
db_obj[field] = value

docs/changelog.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ New features
3636
3. Comma followed by a space
3737
4. Slash wrapped by spaces
3838

39-
..
40-
Bug fixes
41-
~~~~~~~~~
39+
Bug fixes
40+
~~~~~~~~~
41+
42+
- Fix an issue with autotagging where an empty list was previously not
43+
considered as an 'empty' value, which caused beets to overwrite existing
44+
metadata with empty values instead of leaving them unchanged. :bug:`6403`
4245

4346
For plugin developers
4447
~~~~~~~~~~~~~~~~~~~~~

test/test_autotag.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ def setUp(self):
229229
},
230230
]
231231

232-
@pytest.mark.xfail(reason="Album genres are not applied to tracks")
233232
def test_autotag_items(self):
234233
self._apply()
235234

0 commit comments

Comments
 (0)