From b1cc64d4fa4bcf259717dd85110b4e09d9cd92c6 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 17 Mar 2022 06:18:43 -0600 Subject: [PATCH] FEAT: Ability to set sub labels for specific events (#2949) * Add sub label to model and set / delete funs * Add migrations for sub label * Tweaks to API and model * Show sublabel if available * Cleanups * Update docs * Show person in UI title * Fix typo and don't fail on no json * Transfer sub labels for in progress events * Remove sublabel reset * Remove person only check * Make default null * Update docs and formatting * Make default null * Make nullable in migration * Undo null * Update model to accept null * Update migration to accept null * Don't set to default values * Remove redundant defaults and update http logic * Only need a single route * Enforce 20 character limit in http * Update docs to mention 20 character limit * Cleanup * Separate insert and update to make sure updated values are retained when event ends * Use insert instead of replace * Remove redundant if and have should_update_db include clip or snapshot requirement. --- docs/docs/integrations/api.md | 13 +++++- frigate/events.py | 77 ++++++++++++++++++++++----------- frigate/http.py | 38 +++++++++++++--- frigate/models.py | 1 + migrations/008_add_sub_label.py | 46 ++++++++++++++++++++ web/src/routes/Events.jsx | 2 +- 6 files changed, 144 insertions(+), 33 deletions(-) create mode 100644 migrations/008_add_sub_label.py diff --git a/docs/docs/integrations/api.md b/docs/docs/integrations/api.md index 52e6772fd..1569a6774 100644 --- a/docs/docs/integrations/api.md +++ b/docs/docs/integrations/api.md @@ -186,13 +186,24 @@ Sets retain to true for the event id. Sets retain to false for the event id (event may be deleted quickly after removing). +### `POST /api/events//sub_label` + +Set a sub label for an event. For example to update `person` -> `person's name` if they were recognized with facial recognition. +Sub labels must be 20 characters or shorter. + +```json +{ + "subLabel": "some_string" +} +``` + ### `GET /api/events//thumbnail.jpg` Returns a thumbnail for the event id optimized for notifications. Works while the event is in progress and after completion. Passing `?format=android` will convert the thumbnail to 2:1 aspect ratio. ### `GET /api//