Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix audio events in explore section #15286

Merged
merged 3 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/static/frigate-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ components:
title: Sub Label
score:
anyOf:
- type: integer
- type: number
- type: 'null'
title: Score
default: 0
Expand Down Expand Up @@ -3264,7 +3264,7 @@ components:
properties:
end_time:
anyOf:
- type: integer
- type: number
- type: 'null'
title: End Time
type: object
Expand Down
4 changes: 2 additions & 2 deletions frigate/api/defs/events_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions frigate/events/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ 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}"
)

def expire_detections(self) -> None:
now = datetime.datetime.now().timestamp()
Expand Down
1 change: 1 addition & 0 deletions frigate/events/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
)
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/menu/SearchResultActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default function SearchResultActions({
config?.plus?.enabled &&
searchResult.has_snapshot &&
searchResult.end_time &&
searchResult.data.type == "object" &&
!searchResult.plus_id && (
<MenuItem aria-label="Submit to Frigate Plus" onClick={showSnapshot}>
<FrigatePlusIcon className="mr-2 size-4 cursor-pointer text-primary" />
Expand Down Expand Up @@ -197,6 +198,7 @@ export default function SearchResultActions({
config?.plus?.enabled &&
searchResult.has_snapshot &&
searchResult.end_time &&
searchResult.data.type == "object" &&
!searchResult.plus_id && (
<Tooltip>
<TooltipTrigger>
Expand Down
1 change: 1 addition & 0 deletions web/src/components/overlay/detail/ReviewDetailDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ function EventItem({

{event.has_snapshot &&
event.plus_id == undefined &&
event.data.type == "object" &&
config?.plus.enabled && (
<Tooltip>
<TooltipTrigger>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/overlay/detail/SearchDetailDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -626,16 +626,16 @@
</div>
)}
</TransformComponent>
{search.plus_id !== "not_enabled" && search.end_time && (
{search.data.type == "object" && search.plus_id !== "not_enabled" && search.end_time && (

Check warning on line 629 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Replace `·search.plus_id·!==·"not_enabled"·&&` with `⏎··············search.plus_id·!==·"not_enabled"·&&⏎·············`
<Card className="p-1 text-sm md:p-2">

Check warning on line 630 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
<CardContent className="flex flex-col items-center justify-between gap-3 p-2 md:flex-row">

Check warning on line 631 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
<div className={cn("flex flex-col space-y-3")}>

Check warning on line 632 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
<div

Check warning on line 633 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Replace `····················` with `······················`
className={

Check warning on line 634 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
"text-lg font-semibold leading-none tracking-tight"

Check warning on line 635 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
}

Check warning on line 636 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
>

Check warning on line 637 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
Submit To Frigate+

Check warning on line 638 in web/src/components/overlay/detail/SearchDetailDialog.tsx

View workflow job for this annotation

GitHub Actions / Web - Lint

Insert `··`
</div>
<div className="text-sm text-muted-foreground">
Objects in locations you want to avoid are not false
Expand Down