From ac6a0baa68acb7ea7c123cf4b7e300628f582966 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 18 Jan 2026 19:01:50 +0100 Subject: [PATCH] tab 5 --- engine.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/engine.py b/engine.py index 748c5d8..2c6745a 100644 --- a/engine.py +++ b/engine.py @@ -127,7 +127,7 @@ class SorterEngine: # --- IMAGE & ID SCANNING --- @staticmethod def get_images(path, recursive=False): - """Standard image scanner with optional subfolder support.""" + """Scanning logic updated to include png explicitly.""" exts = ('.jpg', '.jpeg', '.png', '.webp', '.bmp', '.tiff') if not path or not os.path.exists(path): return [] image_list = [] @@ -141,6 +141,17 @@ class SorterEngine: return sorted(image_list) @staticmethod + def bulk_cleanup(file_paths, action="unused", root_path=None): + """Handles the 'Finish' button logic: either delete or move to unused.""" + for p in file_paths: + if not os.path.exists(p): continue + if action == "delete": + os.remove(p) + else: + dest = os.path.join(root_path, "unused", os.path.basename(p)) + os.makedirs(os.path.dirname(dest), exist_ok=True) + shutil.move(p, dest) + @staticmethod def get_id_mapping(path): """Groups files by idXXX_ prefix to detect collisions.""" mapping = {}