Remove lazy update from MediaFile

This commit is contained in:
Thomas Scholtes 2014-04-04 13:40:10 +02:00
parent eb4c323bcb
commit e62d36aa69
2 changed files with 5 additions and 9 deletions

View file

@ -1221,7 +1221,6 @@ class MediaFile(object):
if self.mgfile.tags is None:
self.mgfile.add_tags()
# FIXME Deprecated. Use `update` instead
def save(self, id3v23=False):
"""Write the object's tags back to the file.
@ -1302,19 +1301,16 @@ class MediaFile(object):
For any key in ``dict`` that is also a field to store tags the
method retrieves the corresponding value from ``dict`` and
updates the ``MediaFile``. If any of the tags are changed, these
changes are written to the disk.
updates the ``MediaFile``. The changes are then written to the
disk.
By default, MP3 files are saved with ID3v2.4 tags. You can use
the older ID3v2.3 standard by specifying the `id3v23` option.
"""
updated = False
for field in self.fields():
if field in dict and getattr(self, field) != dict[field]:
updated = True
if field in dict:
setattr(self, field, dict[field])
if updated:
self.save(id3v23)
self.save(id3v23)
# Field definitions.

View file

@ -316,7 +316,7 @@ class ExtendedFieldTestMixin(object):
class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
LazySaveTestMixin, ExtendedFieldTestMixin):
ExtendedFieldTestMixin):
"""Test writing and reading tags. Subclasses must set ``extension`` and
``audio_properties``.
"""