Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
Joe Knapper 2025-05-20 17:04:48 +00:00
parent 4a44dceac6
commit 6c8c8bf358

View file

@ -1173,12 +1173,14 @@ class SmartScanThing(Thing):
# JSON is ignored as it's created before any images are captured # JSON is ignored as it's created before any images are captured
for scan in scan_list: for scan in scan_list:
scan_folder = os.path.join(self.base_scan_dir, scan.name, IMG_DIR_NAME) scan_folder = os.path.join(self.base_scan_dir, scan.name, IMG_DIR_NAME)
image_list = [ images_found = False
f for fname in os.listdir(scan_folder):
for f in os.listdir(scan_folder) fpath = os.path.join(scan_folder, fname)
if os.path.isfile(os.path.join(scan_folder, f)) and "json" not in f if os.path.isfile(fpath) and IMAGE_REGEX.search(fname):
] images_found = True
# break as soon as an image is found.
break
if len(image_list) == 0: if not images_found:
path = os.path.join(self.base_scan_dir, scan.name) path = os.path.join(self.base_scan_dir, scan.name)
self._delete_scan(path, logger) self._delete_scan(path, logger)