Revert "Early 0.18 work (#22138)" (#22142)

This reverts commit d24b96d3bb.
This commit is contained in:
Nicolas Mowen
2026-02-26 21:27:31 -07:00
committed by GitHub
parent d24b96d3bb
commit 451d6f5c22
107 changed files with 1049 additions and 6765 deletions
+3 -8
View File
@@ -185,7 +185,7 @@ class TrackedObjectProcessor(threading.Thread):
def snapshot(camera: str, obj: TrackedObject) -> bool:
mqtt_config: CameraMqttConfig = self.config.cameras[camera].mqtt
if mqtt_config.enabled and self.should_mqtt_snapshot(camera, obj):
jpg_bytes, _ = obj.get_img_bytes(
jpg_bytes = obj.get_img_bytes(
ext="jpg",
timestamp=mqtt_config.timestamp,
bounding_box=mqtt_config.bounding_box,
@@ -515,7 +515,6 @@ class TrackedObjectProcessor(threading.Thread):
duration,
source_type,
draw,
pre_capture,
) = payload
# save the snapshot image
@@ -523,11 +522,6 @@ class TrackedObjectProcessor(threading.Thread):
None, event_id, label, draw
)
end_time = frame_time + duration if duration is not None else None
start_time = (
frame_time - self.config.cameras[camera_name].record.event_pre_capture
if pre_capture is None
else frame_time - pre_capture
)
# send event to event maintainer
self.event_sender.publish(
@@ -542,7 +536,8 @@ class TrackedObjectProcessor(threading.Thread):
"sub_label": sub_label,
"score": score,
"camera": camera_name,
"start_time": start_time,
"start_time": frame_time
- self.config.cameras[camera_name].record.event_pre_capture,
"end_time": end_time,
"has_clip": self.config.cameras[camera_name].record.enabled
and include_recording,
+9 -10
View File
@@ -434,7 +434,7 @@ class TrackedObject:
return count > (self.camera_config.detect.stationary.threshold or 50)
def get_thumbnail(self, ext: str) -> bytes | None:
img_bytes, _ = self.get_img_bytes(
img_bytes = self.get_img_bytes(
ext, timestamp=False, bounding_box=False, crop=True, height=175
)
@@ -475,21 +475,20 @@ class TrackedObject:
crop: bool = False,
height: int | None = None,
quality: int | None = None,
) -> tuple[bytes | None, float | None]:
) -> bytes | None:
if self.thumbnail_data is None:
return None, None
return None
try:
frame_time = self.thumbnail_data["frame_time"]
best_frame = cv2.cvtColor(
self.frame_cache[frame_time]["frame"],
self.frame_cache[self.thumbnail_data["frame_time"]]["frame"],
cv2.COLOR_YUV2BGR_I420,
)
except KeyError:
logger.warning(
f"Unable to create jpg because frame {frame_time} is not in the cache"
f"Unable to create jpg because frame {self.thumbnail_data['frame_time']} is not in the cache"
)
return None, None
return None
if bounding_box:
thickness = 2
@@ -571,13 +570,13 @@ class TrackedObject:
ret, jpg = cv2.imencode(f".{ext}", best_frame, quality_params)
if ret:
return jpg.tobytes(), frame_time
return jpg.tobytes()
else:
return None, None
return None
def write_snapshot_to_disk(self) -> None:
snapshot_config: SnapshotsConfig = self.camera_config.snapshots
jpg_bytes, _ = self.get_img_bytes(
jpg_bytes = self.get_img_bytes(
ext="jpg",
timestamp=snapshot_config.timestamp,
bounding_box=snapshot_config.bounding_box,