diff --git a/beets/ui/commands.py b/beets/ui/commands.py index bd9590617..8f0fa0c5e 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1196,7 +1196,7 @@ default_commands.append(list_cmd) # update: Update library contents according to on-disk tags. -def update_items(lib, query, album, move, pretend, fields, exclude_fields): +def update_items(lib, query, album, move, pretend, fields, exclude_fields=None): """For all the items matched by the query, update the library to reflect the item's embedded tags. :param fields: The fields to be stored. If not specified, all fields will diff --git a/test/test_ui.py b/test/test_ui.py index 9e0a67a0e..3b4ce7e3c 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -579,13 +579,13 @@ class UpdateTest(_common.TestCase): util.remove(artfile) def _update(self, query=(), album=False, move=False, reset_mtime=True, - fields=None): + fields=None, excluded_fields=None): self.io.addinput('y') if reset_mtime: self.i.mtime = 0 self.i.store() commands.update_items(self.lib, query, album, move, False, - fields=fields) + fields=fields, excluded_fields=excluded_fields) def test_delete_removes_item(self): self.assertTrue(list(self.lib.items())) @@ -729,6 +729,14 @@ class UpdateTest(_common.TestCase): self.assertEqual(album.albumtype, correct_albumtype) self.assertEqual(album.albumtypes, correct_albumtypes) + def test_modified_metadata_excluded(self): + mf = MediaFile(syspath(self.i.path)) + mf.lyrics = 'new lyrics' + mf.save() + self._update(excluded_fields=['lyrics']) + item = self.lib.items().get() + self.assertNotEqual(item.lyrics, 'new lyrics') + class PrintTest(_common.TestCase): def setUp(self):