Faceset packer now asks whether to delete the original files

This commit is contained in:
iperov 2021-05-25 14:21:38 +04:00
parent 41b517517e
commit 766750941a

View file

@ -84,17 +84,18 @@ class PackedFaceset():
of.write ( struct.pack("Q", offset) )
of.seek(0,2)
of.close()
if io.input_bool(f"Delete original files?", True):
for filename in io.progress_bar_generator(image_paths, "Deleting files"):
Path(filename).unlink()
for filename in io.progress_bar_generator(image_paths, "Deleting files"):
Path(filename).unlink()
if as_person_faceset:
for dir_name in io.progress_bar_generator(dir_names, "Deleting dirs"):
dir_path = samples_path / dir_name
try:
shutil.rmtree(dir_path)
except:
io.log_info (f"unable to remove: {dir_path} ")
if as_person_faceset:
for dir_name in io.progress_bar_generator(dir_names, "Deleting dirs"):
dir_path = samples_path / dir_name
try:
shutil.rmtree(dir_path)
except:
io.log_info (f"unable to remove: {dir_path} ")
@staticmethod
def unpack(samples_path):