mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-20 13:54:36 +01: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
* Instead of checking for indefinite events on a camera before deciding if we should end the segment, only update last_detection_time and last_alert_time if frame_time is greater, which should have the same effect
* Add the ability to set a pre_capture number of seconds when creating a manual event via the API. Default behavior unchanged
* Remove unnecessary _publish_segment_start() call
* Formatting
* handle last_alert_time or last_detection_time being None when checking them against the frame_time
* comment manual_info["label"].split(": ")[0] for clarity
63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
from typing import List, Optional, Union
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from frigate.config.classification import TriggerType
|
|
|
|
|
|
class EventsSubLabelBody(BaseModel):
|
|
subLabel: str = Field(title="Sub label", max_length=100)
|
|
subLabelScore: Optional[float] = Field(
|
|
title="Score for sub label", default=None, gt=0.0, le=1.0
|
|
)
|
|
camera: Optional[str] = Field(
|
|
title="Camera this object is detected on.", default=None
|
|
)
|
|
|
|
|
|
class EventsLPRBody(BaseModel):
|
|
recognizedLicensePlate: str = Field(
|
|
title="Recognized License Plate", max_length=100
|
|
)
|
|
recognizedLicensePlateScore: Optional[float] = Field(
|
|
title="Score for recognized license plate", default=None, gt=0.0, le=1.0
|
|
)
|
|
|
|
|
|
class EventsAttributesBody(BaseModel):
|
|
attributes: List[str] = Field(
|
|
title="Selected classification attributes for the event",
|
|
default_factory=list,
|
|
)
|
|
|
|
|
|
class EventsDescriptionBody(BaseModel):
|
|
description: Union[str, None] = Field(title="The description of the event")
|
|
|
|
|
|
class EventsCreateBody(BaseModel):
|
|
sub_label: Optional[str] = None
|
|
score: Optional[float] = 0
|
|
duration: Optional[int] = 30
|
|
include_recording: Optional[bool] = True
|
|
draw: Optional[dict] = {}
|
|
pre_capture: Optional[int] = None
|
|
|
|
|
|
class EventsEndBody(BaseModel):
|
|
end_time: Optional[float] = None
|
|
|
|
|
|
class EventsDeleteBody(BaseModel):
|
|
event_ids: List[str] = Field(title="The event IDs to delete")
|
|
|
|
|
|
class SubmitPlusBody(BaseModel):
|
|
include_annotation: int = Field(default=1)
|
|
|
|
|
|
class TriggerEmbeddingBody(BaseModel):
|
|
type: TriggerType
|
|
data: str
|
|
threshold: float = Field(default=0.5, ge=0.0, le=1.0)
|