mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-15 11:32:09 +03:00
Cleanup logic
This commit is contained in:
parent
39c26af2cb
commit
556df018a8
@ -130,12 +130,6 @@ class PendingReviewSegment:
|
|||||||
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
self.frame_path, self._frame, [int(cv2.IMWRITE_WEBP_QUALITY), 60]
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_time(self, frame_time: float, update_severity: SeverityEnum) -> None:
|
|
||||||
if update_severity == SeverityEnum.alert:
|
|
||||||
self.last_alert_time = frame_time
|
|
||||||
elif update_severity == SeverityEnum.detection:
|
|
||||||
self.last_detection_time = frame_time
|
|
||||||
|
|
||||||
def get_data(self, ended: bool) -> dict:
|
def get_data(self, ended: bool) -> dict:
|
||||||
end_time = None
|
end_time = None
|
||||||
|
|
||||||
@ -396,18 +390,19 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
should_update_image = False
|
should_update_image = False
|
||||||
should_update_state = False
|
should_update_state = False
|
||||||
|
|
||||||
# if segment is not alert category but current activity is
|
if activity.has_activity_category(SeverityEnum.alert):
|
||||||
if (
|
# update current time for last alert activity
|
||||||
segment.severity != SeverityEnum.alert
|
segment.last_alert_time = frame_time
|
||||||
and activity.has_activity_category(SeverityEnum.alert)
|
|
||||||
):
|
if segment.severity != SeverityEnum.alert:
|
||||||
segment.update_time(frame_time, SeverityEnum.alert)
|
# if segment is not alert category but current activity is
|
||||||
segment.severity = SeverityEnum.alert
|
# update this segment to be an alert
|
||||||
should_update_state = True
|
segment.severity = SeverityEnum.alert
|
||||||
should_update_image = True
|
should_update_state = True
|
||||||
|
should_update_image = True
|
||||||
|
|
||||||
if activity.has_activity_category(SeverityEnum.detection):
|
if activity.has_activity_category(SeverityEnum.detection):
|
||||||
segment.update_time(frame_time, SeverityEnum.detection)
|
segment.last_detection_time = frame_time
|
||||||
|
|
||||||
for object in activity.get_all_objects():
|
for object in activity.get_all_objects():
|
||||||
if not object["sub_label"]:
|
if not object["sub_label"]:
|
||||||
@ -499,7 +494,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
frame_time,
|
frame_time,
|
||||||
SeverityEnum.detection,
|
SeverityEnum.detection,
|
||||||
new_detections,
|
new_detections,
|
||||||
sub_labels=[],
|
sub_labels={},
|
||||||
audio=set(),
|
audio=set(),
|
||||||
zones=list(new_zones),
|
zones=list(new_zones),
|
||||||
)
|
)
|
||||||
@ -527,7 +522,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
detections: dict[str, str] = {}
|
detections: dict[str, str] = {}
|
||||||
sub_labels: dict[str, str] = {}
|
sub_labels: dict[str, str] = {}
|
||||||
zones: list[str] = []
|
zones: list[str] = []
|
||||||
severity = None
|
severity: SeverityEnum | None = None
|
||||||
|
|
||||||
# if activity is alert category mark this review as alert
|
# if activity is alert category mark this review as alert
|
||||||
if severity != SeverityEnum.alert and activity.has_activity_category(
|
if severity != SeverityEnum.alert and activity.has_activity_category(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user