mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
Clarify Album.store() docstring and comments,
explaining the inherit flag, fixed/flex attrs and the strict exclusion of the id field.
This commit is contained in:
parent
31cd0ecb4e
commit
ad3199941d
1 changed files with 7 additions and 5 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Reference in a new issue