Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
parent
747bc3d79a
commit
251b0ca770
1 changed files with 5 additions and 10 deletions
|
|
@ -771,20 +771,15 @@ class SmartScanThing(Thing):
|
||||||
images_folder = os.path.join(path, IMG_DIR_NAME)
|
images_folder = os.path.join(path, IMG_DIR_NAME)
|
||||||
if os.path.isdir(images_folder):
|
if os.path.isdir(images_folder):
|
||||||
folder_contents = os.listdir(images_folder)
|
folder_contents = os.listdir(images_folder)
|
||||||
scan_images = [x for x in folder_contents if IMAGE_REGEX.search(x)]
|
scan_images = [i for i in folder_contents if IMAGE_REGEX.search(x)]
|
||||||
|
stitches = [i for i in folder_contents if i.endswith("_stitched.jpg")]
|
||||||
number_of_images = len(scan_images)
|
number_of_images = len(scan_images)
|
||||||
|
stitch_available = len(stitches) > 0
|
||||||
else:
|
else:
|
||||||
number_of_images = 0
|
number_of_images = 0
|
||||||
|
stitch_available = False
|
||||||
modified = max(os.stat(root).st_mtime for root, _, _ in os.walk(path))
|
modified = max(os.stat(root).st_mtime for root, _, _ in os.walk(path))
|
||||||
# If number of images is 0, should the scan be appended or ignored?
|
|
||||||
# When deleting images, empty scans should be deleted. When displaying
|
|
||||||
# scans in the GUI or choosing a new scan name, should be ignored
|
|
||||||
|
|
||||||
# A function to delete empty scan folders from the disk achieves all of this
|
|
||||||
|
|
||||||
stitch_available=(
|
|
||||||
len([i for i in os.listdir(images_folder) if i.endswith("_stitched.jpg")]) > 0
|
|
||||||
)
|
|
||||||
scans.append(
|
scans.append(
|
||||||
ScanInfo(
|
ScanInfo(
|
||||||
name=f,
|
name=f,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue