Ensure thumb camera directory exists before saving (#17339)

This commit is contained in:
Nicolas Mowen 2025-03-24 08:39:51 -06:00 committed by GitHub
parent a8fa77c6b9
commit c239721021
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -461,9 +461,9 @@ class CameraState:
# create thumbnail with max height of 175 and save
width = int(175 * img_frame.shape[1] / img_frame.shape[0])
thumb = cv2.resize(img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA)
cv2.imwrite(
os.path.join(THUMB_DIR, self.camera_config.name, f"{event_id}.webp"), thumb
)
thumb_path = os.path.join(THUMB_DIR, self.camera_config.name)
os.makedirs(thumb_path, exist_ok=True)
cv2.imwrite(os.path.join(thumb_path, f"{event_id}.webp"), thumb)
def shutdown(self) -> None:
for obj in self.tracked_objects.values():