Fix error in purge_empty_scans if the images dir hadn't been created
This commit is contained in:
parent
ead9c97f69
commit
fe1696df28
1 changed files with 9 additions and 6 deletions
|
|
@ -1212,12 +1212,15 @@ class SmartScanThing(Thing):
|
||||||
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)
|
||||||
images_found = False
|
images_found = False
|
||||||
for fname in os.listdir(scan_folder):
|
# Check the scan directory exists, and if it does loop through each file
|
||||||
fpath = os.path.join(scan_folder, fname)
|
# to check if they are scan captures.
|
||||||
if os.path.isfile(fpath) and IMAGE_REGEX.search(fname):
|
if os.path.isdir(scan_folder):
|
||||||
images_found = True
|
for fname in os.listdir(scan_folder):
|
||||||
# break as soon as an image is found.
|
fpath = os.path.join(scan_folder, fname)
|
||||||
break
|
if os.path.isfile(fpath) and IMAGE_REGEX.search(fname):
|
||||||
|
images_found = True
|
||||||
|
# break as soon as an image is found.
|
||||||
|
break
|
||||||
|
|
||||||
if not images_found:
|
if not images_found:
|
||||||
path = os.path.join(self.base_scan_dir, scan.name)
|
path = os.path.join(self.base_scan_dir, scan.name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue