This commit is contained in:
Arno Hautala 2023-09-09 11:12:58 -04:00
parent 6b8a5cdcbc
commit 65aaa96297
2 changed files with 11 additions and 3 deletions

View file

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

View file

@ -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):