diff options
author | J0J0 Todos <jojo@peek-a-boo.at> | 2023-08-23 06:32:17 +0200 |
---|---|---|
committer | J0J0 Todos <jojo@peek-a-boo.at> | 2023-08-23 06:36:39 +0200 |
commit | d7b7d60111c8f8d28737306af1007bef2da92316 (patch) | |
tree | ba3a9e23643e7a8f41fe201357dd5106301f4ee5 | |
parent | 9616afd3398b23fe6413430ace72cf94664e0e2f (diff) |
Refactor Album.store for code readability
-rw-r--r-- | beets/library.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/beets/library.py b/beets/library.py index 71ce251cd..405b546e2 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1383,12 +1383,13 @@ class Album(LibModel): track_updates = {} track_deletes = set() for key in self._dirty: - if key in self.item_keys and inherit: # Fixed attr - track_updates[key] = self[key] - 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 (fixed) - track_updates[key] = self[key] + if inherit: + if key in self.item_keys: # is a fixed attribute + track_updates[key] = self[key] + elif key not in self: # is a fixed or a flexible attribute + track_deletes.add(key) + elif key != 'id': # is a flexible attribute + track_updates[key] = self[key] with self._db.transaction(): super().store(fields) |