Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions frigate/review/maintainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ def update_existing_segment(
self.frame_manager.close(frame_name)
except FileNotFoundError:
return
# indefinite (manual) events should extend the segment until they end
if (
segment.camera in self.indefinite_events
and len(self.indefinite_events[segment.camera]) > 0
):
has_activity = True

if not has_activity:
if not segment.has_frame:
Expand Down Expand Up @@ -699,13 +705,25 @@ def run(self) -> None:
topic == DetectionTypeEnum.api
and self.config.cameras[camera].review.alerts.enabled
):
current_segment.severity = SeverityEnum.alert
if (
self.config.cameras[camera].review.detections.enabled
and manual_info["label"].split(": ")[0]
in self.config.cameras[camera].review.detections.labels
):
current_segment.last_detection_time = manual_info[
"end_time"
]
else:
current_segment.severity = SeverityEnum.alert
current_segment.last_alert_time = manual_info[
"end_time"
]
elif (
topic == DetectionTypeEnum.lpr
and self.config.cameras[camera].review.detections.enabled
):
current_segment.severity = SeverityEnum.detection
current_segment.last_alert_time = manual_info["end_time"]
current_segment.last_alert_time = manual_info["end_time"]
elif manual_info["state"] == ManualEventState.start:
self.indefinite_events[camera][manual_info["event_id"]] = (
manual_info["label"]
Expand All @@ -717,7 +735,16 @@ def run(self) -> None:
topic == DetectionTypeEnum.api
and self.config.cameras[camera].review.alerts.enabled
):
current_segment.severity = SeverityEnum.alert
if (
not self.config.cameras[
camera
].review.detections.enabled
or manual_info["label"].split(": ")[0]
not in self.config.cameras[
camera
].review.detections.labels
):
current_segment.severity = SeverityEnum.alert
elif (
topic == DetectionTypeEnum.lpr
and self.config.cameras[camera].review.detections.enabled
Expand Down Expand Up @@ -789,11 +816,21 @@ def run(self) -> None:
detections,
)
elif topic == DetectionTypeEnum.api:
if self.config.cameras[camera].review.alerts.enabled:
severity = None
if (
self.config.cameras[camera].review.detections.enabled
and manual_info["label"].split(": ")[0]
in self.config.cameras[camera].review.detections.labels
):
severity = SeverityEnum.detection
elif self.config.cameras[camera].review.alerts.enabled:
severity = SeverityEnum.alert

if severity:
self.active_review_segments[camera] = PendingReviewSegment(
camera,
frame_time,
SeverityEnum.alert,
severity,
{manual_info["event_id"]: manual_info["label"]},
{},
[],
Expand All @@ -820,7 +857,7 @@ def run(self) -> None:
].last_detection_time = manual_info["end_time"]
else:
logger.warning(
f"Manual event API has been called for {camera}, but alerts are disabled. This manual event will not appear as an alert."
f"Manual event API has been called for {camera}, but alerts and detections are disabled. This manual event will not appear as an alert or detection."
)
elif topic == DetectionTypeEnum.lpr:
if self.config.cameras[camera].review.detections.enabled:
Expand Down
3 changes: 1 addition & 2 deletions frigate/track/object_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ def create_manual_event(self, payload: tuple) -> None:
"sub_label": sub_label,
"score": score,
"camera": camera_name,
"start_time": frame_time
- self.config.cameras[camera_name].record.event_pre_capture,
"start_time": frame_time,
"end_time": end_time,
"has_clip": self.config.cameras[camera_name].record.enabled
and include_recording,
Expand Down
Loading