Compare commits

...

2 Commits

Author SHA1 Message Date
Josh Hawkins
3d30452cfb
Merge c6918d3477 into c136e5e8bd 2025-12-06 14:53:20 +00:00
Nicolas Mowen
c6918d3477 Move files into try for classification rollover 2025-12-06 07:53:15 -07:00

View File

@ -639,14 +639,14 @@ def write_classification_attempt(
os.makedirs(folder, exist_ok=True)
cv2.imwrite(file, frame)
files = sorted(
filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)
# delete oldest face image if maximum is reached
try:
files = sorted(
filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)
if len(files) > max_files:
os.unlink(os.path.join(folder, files[-1]))
except FileNotFoundError: