From 01aa930c3e4a7d32967789b7479975342bb1652b Mon Sep 17 00:00:00 2001 From: tpjanssen <25168870+tpjanssen@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:07:41 +0100 Subject: [PATCH 1/3] Fix audio events in explore section Make sure that audio events are listed in the explore section --- docs/static/frigate-api.yaml | 4 ++-- frigate/api/defs/events_body.py | 4 ++-- frigate/events/audio.py | 3 +++ frigate/events/external.py | 1 + web/src/components/overlay/detail/SearchDetailDialog.tsx | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/static/frigate-api.yaml b/docs/static/frigate-api.yaml index 325af28500..5e4ecdbdc3 100644 --- a/docs/static/frigate-api.yaml +++ b/docs/static/frigate-api.yaml @@ -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 diff --git a/frigate/api/defs/events_body.py b/frigate/api/defs/events_body.py index ca1256598b..db2b4060ba 100644 --- a/frigate/api/defs/events_body.py +++ b/frigate/api/defs/events_body.py @@ -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): diff --git a/frigate/events/audio.py b/frigate/events/audio.py index 80d035894f..42591ea7d6 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -216,6 +216,9 @@ def handle_detection(self, label: str, score: float) -> None: "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() diff --git a/frigate/events/external.py b/frigate/events/external.py index 922917bb4d..02671b2079 100644 --- a/frigate/events/external.py +++ b/frigate/events/external.py @@ -108,6 +108,7 @@ def finish_manual_event(self, event_id: str, end_time: float) -> None: EventTypeEnum.api, EventStateEnum.end, None, + "", {"id": event_id, "end_time": end_time}, ) ) diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index f7af31606e..f63dffcc15 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -626,7 +626,7 @@ export function ObjectSnapshotTab({ )} - {search.plus_id !== "not_enabled" && search.end_time && ( + {search.data.type == "object" && search.plus_id !== "not_enabled" && search.end_time && (
From 78fed002e054ddd24d59eed39d651ce7121d59cb Mon Sep 17 00:00:00 2001 From: tpjanssen <25168870+tpjanssen@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:07:51 +0100 Subject: [PATCH 2/3] Update audio.py --- frigate/events/audio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frigate/events/audio.py b/frigate/events/audio.py index 42591ea7d6..7675f821b4 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -216,6 +216,7 @@ def handle_detection(self, label: str, score: float) -> None: "label": label, "last_detection": datetime.datetime.now().timestamp(), } + else: self.logger.warning( f"Failed to create audio event with status code {resp.status_code}" ) From 3d0efc4983bab03d7e0cf38d1f177b331c9e6e8b Mon Sep 17 00:00:00 2001 From: tpjanssen <25168870+tpjanssen@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:58:13 +0100 Subject: [PATCH 3/3] Hide other submit options Only allow submits for objects only --- web/src/components/menu/SearchResultActions.tsx | 2 ++ web/src/components/overlay/detail/ReviewDetailDialog.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/web/src/components/menu/SearchResultActions.tsx b/web/src/components/menu/SearchResultActions.tsx index 10f0ed623d..277ce21690 100644 --- a/web/src/components/menu/SearchResultActions.tsx +++ b/web/src/components/menu/SearchResultActions.tsx @@ -128,6 +128,7 @@ export default function SearchResultActions({ config?.plus?.enabled && searchResult.has_snapshot && searchResult.end_time && + searchResult.data.type == "object" && !searchResult.plus_id && ( @@ -197,6 +198,7 @@ export default function SearchResultActions({ config?.plus?.enabled && searchResult.has_snapshot && searchResult.end_time && + searchResult.data.type == "object" && !searchResult.plus_id && ( diff --git a/web/src/components/overlay/detail/ReviewDetailDialog.tsx b/web/src/components/overlay/detail/ReviewDetailDialog.tsx index 74a9950b9e..c3e7ac91dd 100644 --- a/web/src/components/overlay/detail/ReviewDetailDialog.tsx +++ b/web/src/components/overlay/detail/ReviewDetailDialog.tsx @@ -379,6 +379,7 @@ function EventItem({ {event.has_snapshot && event.plus_id == undefined && + event.data.type == "object" && config?.plus.enabled && (