mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-07 00:06:57 +01:00
parent
a9ff795948
commit
7854e1c2c1
@ -28,3 +28,7 @@ class EventsCreateBody(BaseModel):
|
|||||||
|
|
||||||
class EventsEndBody(BaseModel):
|
class EventsEndBody(BaseModel):
|
||||||
end_time: Optional[int] = datetime.now().timestamp()
|
end_time: Optional[int] = datetime.now().timestamp()
|
||||||
|
|
||||||
|
|
||||||
|
class SubmitPlusBody(BaseModel):
|
||||||
|
include_annotation: int = Field(default=1)
|
||||||
|
@ -22,6 +22,7 @@ from frigate.api.defs.events_body import (
|
|||||||
EventsDescriptionBody,
|
EventsDescriptionBody,
|
||||||
EventsEndBody,
|
EventsEndBody,
|
||||||
EventsSubLabelBody,
|
EventsSubLabelBody,
|
||||||
|
SubmitPlusBody,
|
||||||
)
|
)
|
||||||
from frigate.api.defs.events_query_parameters import (
|
from frigate.api.defs.events_query_parameters import (
|
||||||
DEFAULT_TIME_RANGE,
|
DEFAULT_TIME_RANGE,
|
||||||
@ -616,7 +617,7 @@ def set_retain(event_id: str):
|
|||||||
|
|
||||||
|
|
||||||
@router.post("/events/{event_id}/plus")
|
@router.post("/events/{event_id}/plus")
|
||||||
def send_to_plus(request: Request, event_id: str):
|
def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = None):
|
||||||
if not request.app.frigate_config.plus_api.is_active():
|
if not request.app.frigate_config.plus_api.is_active():
|
||||||
message = "PLUS_API_KEY environment variable is not set"
|
message = "PLUS_API_KEY environment variable is not set"
|
||||||
logger.error(message)
|
logger.error(message)
|
||||||
@ -630,9 +631,7 @@ def send_to_plus(request: Request, event_id: str):
|
|||||||
status_code=400,
|
status_code=400,
|
||||||
)
|
)
|
||||||
|
|
||||||
include_annotation = (
|
include_annotation = body.include_annotation if body is not None else None
|
||||||
request.json.get("include_annotation") if request.is_json else None
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
event = Event.get(Event.id == event_id)
|
event = Event.get(Event.id == event_id)
|
||||||
@ -945,7 +944,7 @@ def set_description(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.put("/events/<id>/description/regenerate")
|
@router.put("/events/{event_id}/description/regenerate")
|
||||||
def regenerate_description(request: Request, event_id: str):
|
def regenerate_description(request: Request, event_id: str):
|
||||||
try:
|
try:
|
||||||
event: Event = Event.get(Event.id == event_id)
|
event: Event = Event.get(Event.id == event_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user