sane-tag-music: better log formatting when moving a file

This commit is contained in:
2024-07-13 01:44:28 +00:00
parent f4b6bbfbd5
commit e04dd6cb7d

View File

@@ -848,13 +848,19 @@ class Tagger:
if new_path == file_.path_:
return self.skip_unchanged(file_.path_, tags)
self.show_pathdif(file_.path_, new_path)
if self.confirm():
if self.guard_dry_run(f"moving file: {file_.path_} -> {new_path}"):
logger.info(f"moving file: {file_.path_} -> {new_path}")
if self.guard_dry_run(f"moving file"):
assert not os.path.exists(new_path), f"{file_.path_} -> {new_path} would clobber destination!"
# os.renames creates the necessary parents, and then prunes leaf directories
os.renames(file_.path_, new_path)
def show_pathdif(self, old_path: str, new_path: str):
logger.info( "updating path:")
logger.info(f" {old_path}")
logger.info(f" -> {new_path}")
def show_tagdif(self, path_: str, old_tags: Tags, new_tags: Tags):
logger.info(f"updating tags for {path_}")
logger.info(f" {old_tags}")