mirror of
https://github.com/beetbox/beets.git
synced 2026-02-08 16:34:12 +01:00
Merge 9b8f43ad97 into cdfb813910
This commit is contained in:
commit
3e428f82be
1 changed files with 11 additions and 1 deletions
|
|
@ -1006,6 +1006,12 @@ class Item(LibModel):
|
|||
log.error("{}", exc)
|
||||
return False
|
||||
|
||||
def _media_tags_changed(self, original, modified):
|
||||
for f in self._media_tag_fields: # this is defined in the class already
|
||||
if getattr(original, f) != getattr(modified, f):
|
||||
return True
|
||||
return False
|
||||
|
||||
def try_sync(self, write, move, with_album=True):
|
||||
"""Synchronize the item with the database and, possibly, update its
|
||||
tags on disk and its path (by moving the file).
|
||||
|
|
@ -1018,8 +1024,12 @@ class Item(LibModel):
|
|||
Similar to calling :meth:`write`, :meth:`move`, and :meth:`store`
|
||||
(conditionally).
|
||||
"""
|
||||
if write:
|
||||
original = Item.from_path(self.path)
|
||||
|
||||
# only write tags if media tags changed
|
||||
if write and self._media_tags_changed(original, self):
|
||||
self.try_write()
|
||||
|
||||
if move:
|
||||
# Check whether this file is inside the library directory.
|
||||
if self._db and self._db.directory in util.ancestry(self.path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue