From ad3199941decbc0fbf0b79412d1ea110215e648d Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Sun, 6 Aug 2023 09:58:32 +0200 Subject: [PATCH] Clarify Album.store() docstring and comments, explaining the inherit flag, fixed/flex attrs and the strict exclusion of the id field. --- beets/library.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/beets/library.py b/beets/library.py index 3af15978a..71ce251cd 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1372,20 +1372,22 @@ class Album(LibModel): def store(self, fields=None, inherit=True): """Update the database with the album information. - The album's tracks are also updated. - `fields` represents the fields to be stored. If not specified, all fields will be. + + The album's tracks are also updated when the `inherit` flag is enabled. + This applies to fixed attributes as well as flexible ones. The `id` + attribute of the album will never be inherited. """ # Get modified track fields. track_updates = {} track_deletes = set() for key in self._dirty: - if key in self.item_keys and inherit: + if key in self.item_keys and inherit: # Fixed attr track_updates[key] = self[key] - elif key not in self and inherit: + elif key not in self and inherit: # Fixed or flex attr track_deletes.add(key) - elif key != 'id' and inherit: # Could be a flex attr or id + elif key != 'id' and inherit: # Could be a flex attr or id (fixed) track_updates[key] = self[key] with self._db.transaction():