sane-tag-media: remove unused "confirm" function

This commit is contained in:
2024-08-03 07:19:53 +00:00
parent 4761690b6d
commit 0dba9987c5

View File

@@ -915,9 +915,8 @@ class Tagger:
self.show_tagdif(file_.path_, old_tags, new_tags) self.show_tagdif(file_.path_, old_tags, new_tags)
if self.confirm(): if self.guard_dry_run("writing tags"):
if self.guard_dry_run("writing tags"): file_.write_tags(new_tags)
file_.write_tags(new_tags)
def fix_path(self, file_: MediaFile) -> None: def fix_path(self, file_: MediaFile) -> None:
tags = self.tags_for(file_) tags = self.tags_for(file_)
@@ -932,11 +931,10 @@ class Tagger:
self.show_pathdif(file_.path_, new_path) self.show_pathdif(file_.path_, new_path)
if self.confirm(): if self.guard_dry_run(f"moving file"):
if self.guard_dry_run(f"moving file"): assert not os.path.exists(new_path), f"{file_.path_} -> {new_path} would clobber destination!"
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 creates the necessary parents, and then prunes leaf directories os.renames(file_.path_, new_path)
os.renames(file_.path_, new_path)
def show_pathdif(self, old_path: str, new_path: str): def show_pathdif(self, old_path: str, new_path: str):
logger.info( "updating path:") logger.info( "updating path:")
@@ -952,10 +950,6 @@ class Tagger:
logger.debug(f"skipping unchanged {path_}") logger.debug(f"skipping unchanged {path_}")
logger.debug(f" {tags}") logger.debug(f" {tags}")
def confirm(self) -> bool:
# TODO: actually prompt
return True
def guard_dry_run(self, msg: str) -> bool: def guard_dry_run(self, msg: str) -> bool:
if self.dry_run: if self.dry_run:
print(f"dry run: not {msg}") print(f"dry run: not {msg}")