Synchronize the item with the database and, possibly, update its tags on disk and its path (by moving the file). `write` indicates whether to write new tags into the file. Similarly, `move` controls whether the path should be updated. In the latter case, files are *o
(self, write, move, with_album=True)
| 972 | return False |
| 973 | |
| 974 | def try_sync(self, write, move, with_album=True): |
| 975 | """Synchronize the item with the database and, possibly, update its |
| 976 | tags on disk and its path (by moving the file). |
| 977 | |
| 978 | `write` indicates whether to write new tags into the file. Similarly, |
| 979 | `move` controls whether the path should be updated. In the |
| 980 | latter case, files are *only* moved when they are inside their |
| 981 | library's directory (if any). |
| 982 | |
| 983 | Similar to calling :meth:`write`, :meth:`move`, and :meth:`store` |
| 984 | (conditionally). |
| 985 | """ |
| 986 | if write: |
| 987 | self.try_write() |
| 988 | if move: |
| 989 | # Check whether this file is inside the library directory. |
| 990 | if self._db and self._db.directory in util.ancestry(self.path): |
| 991 | log.debug("moving {.filepath} to synchronize path", self) |
| 992 | self.move(with_album=with_album) |
| 993 | self.store() |
| 994 | |
| 995 | # Files themselves. |
| 996 |