diff --git a/birbcam/birbwatcher.py b/birbcam/birbwatcher.py index 5c726c6..f982ffe 100644 --- a/birbcam/birbwatcher.py +++ b/birbcam/birbwatcher.py @@ -109,7 +109,7 @@ def __loop(self, camera, rawCapture, mask): if didTakeFullPicture[0]: thumbfile = f"{self.config.saveTo}/thumb/{didTakeFullPicture[1]}" cv2.imwrite(thumbfile, now) - self.pictureLogger.log_picture(didTakeFullPicture[2], thumbfile, classifyResults) + self.pictureLogger.log_picture(didTakeFullPicture[2], thumbfile, classifyResults, self.shutterFlipper.label, self.isoFlipper.label) else: # logging.info(f"[birbvision] ignore: {classifyResults[0].label} @ {classifyResults[0].confidence:.2f}") self.fullPictureTaker.reset_time() diff --git a/birbcam/picturelogger/picturelogger.py b/birbcam/picturelogger/picturelogger.py index 1edc290..61690ba 100644 --- a/birbcam/picturelogger/picturelogger.py +++ b/birbcam/picturelogger/picturelogger.py @@ -4,19 +4,21 @@ class PictureLogger: def __init__(self, file_source): self._loggedPictures = [] - self.__read_picture_history(file_source) + #self.__read_picture_history(file_source) self._log_file = open(file_source, mode="a", encoding="utf-8") def __del__(self): self._log_file.close() - def log_picture(self, fullPath, thumbPath, classification): + def log_picture(self, fullPath, thumbPath, classification, shutter, iso): entry = { "full": fullPath, "thumb": thumbPath, "evaluation": [dictify_classification(c) for c in classification], - "time": time() + "time": time(), + "shutter": shutter, + "iso": iso } self.__append_to_file(entry) @@ -34,7 +36,7 @@ def __append_to_file(self, entry): def __serialize_entry(self, entry): c = self.__serialize_classification(entry["evaluation"]) - return f"{entry['time']}|{entry['full']}|{entry['thumb']}|{c}" + return f"{entry['time']}|{entry['full']}|{entry['thumb']}|{c}|{entry['shutter']}|{entry['iso']}" def __deserialize_entry(self, string): split = string.split("|") @@ -42,7 +44,9 @@ def __deserialize_entry(self, string): "time": split[0], "full": split[1], "thumb": split[2], - "evaluation": self.__deserialize_classification(split[3]) + "evaluation": self.__deserialize_classification(split[3]), + "shutter": split[4], + "iso": split[5] } def __serialize_classification(self, results):