From acff509585eacc4c4735cedf725ba33bcf17ceab Mon Sep 17 00:00:00 2001 From: Arno Hautala Date: Sun, 10 Sep 2023 22:24:36 -0400 Subject: [PATCH] smaller set of fields to update; comments --- beets/ui/commands.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 275927037..74e7f7d45 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1206,16 +1206,25 @@ def update_items(lib, query, album, move, pretend, fields, fields will be. """ with lib.transaction(): + items, _ = _do_query(lib, query, album) if move and fields is not None and 'path' not in fields: # Special case: if an item needs to be moved, the path field has to # updated; otherwise the new path will not be reflected in the # database. fields.append('path') - items, _ = _do_query(lib, query, album) - - item_fields = fields or library.Item._fields.keys() + if fields is None: + # no fields were provided, update all media fields + item_fields = fields or library.Item._media_fields + if move and 'path' not in item_fields: + # move is enabled, add 'path' to the list of fields to update + item_fields.add('path') + else: + # fields was provided, just update those + item_fields = fields + # get all the album fields to update album_fields = fields or library.Album._fields.keys() if exclude_fields: + # remove any excluded fields from the item and album sets item_fields = [f for f in item_fields if f not in exclude_fields] album_fields = [f for f in album_fields if f not in exclude_fields]