mirror of
https://github.com/beetbox/beets.git
synced 2026-01-10 01:50:34 +01:00
Fix #856: album dirty tracking
This commit is contained in:
parent
d8211f1d76
commit
36d332ab6a
4 changed files with 21 additions and 1 deletions
|
|
@ -129,6 +129,12 @@ class Model(object):
|
|||
are subclasses of `Sort`.
|
||||
"""
|
||||
|
||||
_always_dirty = False
|
||||
"""By default, fields only become "dirty" when their value actually
|
||||
changes. Enabling this flag marks fields as dirty even when the new
|
||||
value is the same as the old value (e.g., `o.f = o.f`).
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def _getters(cls):
|
||||
"""Return a mapping from field names to getter functions.
|
||||
|
|
@ -235,7 +241,7 @@ class Model(object):
|
|||
# Assign value and possibly mark as dirty.
|
||||
old_value = source.get(key)
|
||||
source[key] = value
|
||||
if old_value != value:
|
||||
if self._always_dirty or old_value != value:
|
||||
self._dirty.add(key)
|
||||
|
||||
def __delitem__(self, key):
|
||||
|
|
|
|||
|
|
@ -702,6 +702,7 @@ class Album(LibModel):
|
|||
"""
|
||||
_table = 'albums'
|
||||
_flex_table = 'album_attributes'
|
||||
_always_dirty = True
|
||||
_fields = {
|
||||
'id': types.PRIMARY_ID,
|
||||
'artpath': PathType(),
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ Fixes:
|
|||
* :doc:`/plugins/chroma`: Limit the number of releases and recordings fetched
|
||||
as the result of an Acoustid match to avoid extremely long processing times
|
||||
for very popular music. :bug:`1068`
|
||||
* Fix an issue where modifying an album's field without actually changing it
|
||||
would not update the corresponding tracks to bring differing tracks back in
|
||||
line with the album. :bug:`856`
|
||||
|
||||
|
||||
1.3.8 (September 17, 2014)
|
||||
|
|
|
|||
|
|
@ -836,6 +836,16 @@ class AlbumInfoTest(_common.TestCase):
|
|||
self.i.remove()
|
||||
self.assertEqual(len(self.lib.albums()), 0)
|
||||
|
||||
def test_noop_albuminfo_changes_affect_items(self):
|
||||
i = self.lib.items()[0]
|
||||
i.album = 'foobar'
|
||||
i.store()
|
||||
ai = self.lib.get_album(self.i)
|
||||
ai.album = ai.album
|
||||
ai.store()
|
||||
i = self.lib.items()[0]
|
||||
self.assertEqual(i.album, ai.album)
|
||||
|
||||
|
||||
class ArtDestinationTest(_common.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue