mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-30 03:44:57 +03:00
- API created events will be alerts OR detections, depending on the event label, defaulting to alerts
- Indefinite API events will extend the recording segment until those events are ended - API event start time is the actual start time, instead of having a pre-buffer of record.event_pre_capture
This commit is contained in:
parent
5fdb56a106
commit
a587f5bf40
@ -484,6 +484,11 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# indefinite (manual) events should extend the segment until they end
|
||||||
|
if (
|
||||||
|
segment.camera not in self.indefinite_events
|
||||||
|
or len(self.indefinite_events[segment.camera]) == 0
|
||||||
|
):
|
||||||
if segment.severity == SeverityEnum.alert and frame_time > (
|
if segment.severity == SeverityEnum.alert and frame_time > (
|
||||||
segment.last_alert_time + camera_config.review.alerts.cutoff_time
|
segment.last_alert_time + camera_config.review.alerts.cutoff_time
|
||||||
):
|
):
|
||||||
@ -695,11 +700,20 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
current_segment.detections[manual_info["event_id"]] = (
|
current_segment.detections[manual_info["event_id"]] = (
|
||||||
manual_info["label"]
|
manual_info["label"]
|
||||||
)
|
)
|
||||||
|
if topic == DetectionTypeEnum.api:
|
||||||
if (
|
if (
|
||||||
topic == DetectionTypeEnum.api
|
self.config.cameras[camera].review.detections.enabled
|
||||||
and self.config.cameras[camera].review.alerts.enabled
|
and manual_info["label"].split(": ")[0]
|
||||||
|
in self.config.cameras[camera].review.detections.labels
|
||||||
):
|
):
|
||||||
|
current_segment.last_detection_time = manual_info[
|
||||||
|
"end_time"
|
||||||
|
]
|
||||||
|
elif self.config.cameras[camera].review.alerts.enabled:
|
||||||
current_segment.severity = SeverityEnum.alert
|
current_segment.severity = SeverityEnum.alert
|
||||||
|
current_segment.last_alert_time = manual_info[
|
||||||
|
"end_time"
|
||||||
|
]
|
||||||
elif (
|
elif (
|
||||||
topic == DetectionTypeEnum.lpr
|
topic == DetectionTypeEnum.lpr
|
||||||
and self.config.cameras[camera].review.detections.enabled
|
and self.config.cameras[camera].review.detections.enabled
|
||||||
@ -716,6 +730,15 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
if (
|
if (
|
||||||
topic == DetectionTypeEnum.api
|
topic == DetectionTypeEnum.api
|
||||||
and self.config.cameras[camera].review.alerts.enabled
|
and self.config.cameras[camera].review.alerts.enabled
|
||||||
|
):
|
||||||
|
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
|
current_segment.severity = SeverityEnum.alert
|
||||||
elif (
|
elif (
|
||||||
@ -789,11 +812,21 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
detections,
|
detections,
|
||||||
)
|
)
|
||||||
elif topic == DetectionTypeEnum.api:
|
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(
|
self.active_review_segments[camera] = PendingReviewSegment(
|
||||||
camera,
|
camera,
|
||||||
frame_time,
|
frame_time,
|
||||||
SeverityEnum.alert,
|
severity,
|
||||||
{manual_info["event_id"]: manual_info["label"]},
|
{manual_info["event_id"]: manual_info["label"]},
|
||||||
{},
|
{},
|
||||||
[],
|
[],
|
||||||
@ -811,6 +844,9 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
self.active_review_segments[
|
self.active_review_segments[
|
||||||
camera
|
camera
|
||||||
].last_detection_time = sys.maxsize
|
].last_detection_time = sys.maxsize
|
||||||
|
self._publish_segment_start(
|
||||||
|
self.active_review_segments[camera]
|
||||||
|
)
|
||||||
elif manual_info["state"] == ManualEventState.complete:
|
elif manual_info["state"] == ManualEventState.complete:
|
||||||
self.active_review_segments[
|
self.active_review_segments[
|
||||||
camera
|
camera
|
||||||
@ -820,7 +856,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
].last_detection_time = manual_info["end_time"]
|
].last_detection_time = manual_info["end_time"]
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
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:
|
elif topic == DetectionTypeEnum.lpr:
|
||||||
if self.config.cameras[camera].review.detections.enabled:
|
if self.config.cameras[camera].review.detections.enabled:
|
||||||
|
|||||||
@ -536,8 +536,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
"sub_label": sub_label,
|
"sub_label": sub_label,
|
||||||
"score": score,
|
"score": score,
|
||||||
"camera": camera_name,
|
"camera": camera_name,
|
||||||
"start_time": frame_time
|
"start_time": frame_time,
|
||||||
- self.config.cameras[camera_name].record.event_pre_capture,
|
|
||||||
"end_time": end_time,
|
"end_time": end_time,
|
||||||
"has_clip": self.config.cameras[camera_name].record.enabled
|
"has_clip": self.config.cameras[camera_name].record.enabled
|
||||||
and include_recording,
|
and include_recording,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user