Fix audio events in explore section

Make sure that audio events are listed in the explore section
This commit is contained in:
tpjanssen 2024-12-01 13:07:41 +01:00
parent 71e8f75a01
commit 01aa930c3e
5 changed files with 9 additions and 5 deletions

View File

@ -3225,7 +3225,7 @@ components:
title: Sub Label
score:
anyOf:
- type: integer
- type: number
- type: 'null'
title: Score
default: 0
@ -3264,7 +3264,7 @@ components:
properties:
end_time:
anyOf:
- type: integer
- type: number
- type: 'null'
title: End Time
type: object

View File

@ -17,14 +17,14 @@ class EventsDescriptionBody(BaseModel):
class EventsCreateBody(BaseModel):
source_type: Optional[str] = "api"
sub_label: Optional[str] = None
score: Optional[int] = 0
score: Optional[float] = 0
duration: Optional[int] = 30
include_recording: Optional[bool] = True
draw: Optional[dict] = {}
class EventsEndBody(BaseModel):
end_time: Optional[int] = None
end_time: Optional[float] = None
class SubmitPlusBody(BaseModel):

View File

@ -216,6 +216,9 @@ class AudioEventMaintainer(threading.Thread):
"label": label,
"last_detection": datetime.datetime.now().timestamp(),
}
self.logger.warning(
f"Failed to create audio event with status code {resp.status_code}"
)
def expire_detections(self) -> None:
now = datetime.datetime.now().timestamp()

View File

@ -108,6 +108,7 @@ class ExternalEventProcessor:
EventTypeEnum.api,
EventStateEnum.end,
None,
"",
{"id": event_id, "end_time": end_time},
)
)

View File

@ -626,7 +626,7 @@ export function ObjectSnapshotTab({
</div>
)}
</TransformComponent>
{search.plus_id !== "not_enabled" && search.end_time && (
{search.data.type == "object" && search.plus_id !== "not_enabled" && search.end_time && (
<Card className="p-1 text-sm md:p-2">
<CardContent className="flex flex-col items-center justify-between gap-3 p-2 md:flex-row">
<div className={cn("flex flex-col space-y-3")}>