mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-13 02:02:48 +03:00
Tracked object events only carried the object's own frame_time, which stays at its last detection when the object isn't detected in a frame, so embeddings couldn't check the slot it read and could crop face or plate data from a frame that had already been overwritten. Events now carry the time of the frame they name, and embeddings passes it to `get()`.
78 lines
1.6 KiB
Python
78 lines
1.6 KiB
Python
"""Facilitates communication between processes."""
|
|
|
|
from typing import Any
|
|
|
|
from frigate.events.types import EventStateEnum, EventTypeEnum
|
|
|
|
from .zmq_proxy import Publisher, Subscriber
|
|
|
|
|
|
class EventUpdatePublisher(
|
|
Publisher[
|
|
tuple[
|
|
EventTypeEnum,
|
|
EventStateEnum,
|
|
str | None,
|
|
str,
|
|
dict[str, Any],
|
|
float | None,
|
|
]
|
|
]
|
|
):
|
|
"""Publishes events (objects, audio, manual)."""
|
|
|
|
topic_base = "event/"
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__("update")
|
|
|
|
def publish(
|
|
self,
|
|
payload: tuple[
|
|
EventTypeEnum,
|
|
EventStateEnum,
|
|
str | None,
|
|
str,
|
|
dict[str, Any],
|
|
float | None,
|
|
],
|
|
sub_topic: str = "",
|
|
) -> None:
|
|
super().publish(payload, sub_topic)
|
|
|
|
|
|
class EventUpdateSubscriber(Subscriber):
|
|
"""Receives event updates."""
|
|
|
|
topic_base = "event/"
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__("update")
|
|
|
|
|
|
class EventEndPublisher(
|
|
Publisher[tuple[EventTypeEnum, EventStateEnum, str, dict[str, Any]]]
|
|
):
|
|
"""Publishes events that have ended."""
|
|
|
|
topic_base = "event/"
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__("finalized")
|
|
|
|
def publish(
|
|
self,
|
|
payload: tuple[EventTypeEnum, EventStateEnum, str, dict[str, Any]],
|
|
sub_topic: str = "",
|
|
) -> None:
|
|
super().publish(payload, sub_topic)
|
|
|
|
|
|
class EventEndSubscriber(Subscriber):
|
|
"""Receives events that have ended."""
|
|
|
|
topic_base = "event/"
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__("finalized")
|