mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
Fix event entries (#14093)
This commit is contained in:
parent
3cff0df0ce
commit
5b0c1e5b9e
@ -125,6 +125,9 @@ class EventProcessor(threading.Thread):
|
|||||||
updated_db = False
|
updated_db = False
|
||||||
|
|
||||||
# if this is the first message, just store it and continue, its not time to insert it in the db
|
# if this is the first message, just store it and continue, its not time to insert it in the db
|
||||||
|
if event_type == EventStateEnum.start:
|
||||||
|
self.events_in_process[event_data["id"]] = event_data
|
||||||
|
|
||||||
if should_update_db(self.events_in_process[event_data["id"]], event_data):
|
if should_update_db(self.events_in_process[event_data["id"]], event_data):
|
||||||
updated_db = True
|
updated_db = True
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
@ -7,7 +7,7 @@ from multiprocessing import Queue
|
|||||||
from multiprocessing.synchronize import Event as MpEvent
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.events.maintainer import EventTypeEnum
|
from frigate.events.maintainer import EventStateEnum, EventTypeEnum
|
||||||
from frigate.models import Timeline
|
from frigate.models import Timeline
|
||||||
from frigate.util.builtin import to_relative_box
|
from frigate.util.builtin import to_relative_box
|
||||||
|
|
||||||
@ -44,10 +44,13 @@ class TimelineProcessor(threading.Thread):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if input_type == EventTypeEnum.tracked_object:
|
if input_type == EventTypeEnum.tracked_object:
|
||||||
if prev_event_data is not None and event_data is not None:
|
# None prev_event_data is only allowed for the start of an event
|
||||||
self.handle_object_detection(
|
if event_type != EventStateEnum.start and prev_event_data is None:
|
||||||
camera, event_type, prev_event_data, event_data
|
continue
|
||||||
)
|
|
||||||
|
self.handle_object_detection(
|
||||||
|
camera, event_type, prev_event_data, event_data
|
||||||
|
)
|
||||||
elif input_type == EventTypeEnum.api:
|
elif input_type == EventTypeEnum.api:
|
||||||
self.handle_api_entry(camera, event_type, event_data)
|
self.handle_api_entry(camera, event_type, event_data)
|
||||||
|
|
||||||
@ -118,10 +121,10 @@ class TimelineProcessor(threading.Thread):
|
|||||||
for e in self.pre_event_cache[event_id]:
|
for e in self.pre_event_cache[event_id]:
|
||||||
e[Timeline.data]["sub_label"] = event_data["sub_label"]
|
e[Timeline.data]["sub_label"] = event_data["sub_label"]
|
||||||
|
|
||||||
if event_type == "start":
|
if event_type == EventStateEnum.start:
|
||||||
timeline_entry[Timeline.class_type] = "visible"
|
timeline_entry[Timeline.class_type] = "visible"
|
||||||
save = True
|
save = True
|
||||||
elif event_type == "update":
|
elif event_type == EventStateEnum.update:
|
||||||
if (
|
if (
|
||||||
len(prev_event_data["current_zones"]) < len(event_data["current_zones"])
|
len(prev_event_data["current_zones"]) < len(event_data["current_zones"])
|
||||||
and not event_data["stationary"]
|
and not event_data["stationary"]
|
||||||
@ -140,7 +143,7 @@ class TimelineProcessor(threading.Thread):
|
|||||||
event_data["attributes"].keys()
|
event_data["attributes"].keys()
|
||||||
)[0]
|
)[0]
|
||||||
save = True
|
save = True
|
||||||
elif event_type == "end":
|
elif event_type == EventStateEnum.end:
|
||||||
timeline_entry[Timeline.class_type] = "gone"
|
timeline_entry[Timeline.class_type] = "gone"
|
||||||
save = True
|
save = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user