From 580832d34a273092ed6a68d80d5ec1ab41d3590a Mon Sep 17 00:00:00 2001 From: tpjanssen <25168870+tpjanssen@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:59:06 +0100 Subject: [PATCH] Clear plus id of submitted events --- docs/docs/integrations/api.md | 4 ++++ frigate/http.py | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/docs/integrations/api.md b/docs/docs/integrations/api.md index 20877bb6f..44216070f 100644 --- a/docs/docs/integrations/api.md +++ b/docs/docs/integrations/api.md @@ -201,6 +201,10 @@ Permanently deletes the event along with any clips/snapshots. Sets retain to true for the event id. +### `DELETE /api/events//plus` + +Clears the submit flag of an event that was previously submitted to Frigate+. Useful when an event was submitted as a false positive while being a positive, or vice versa. Also make sure to delete the image in Frigate+ accordingly! + ### `POST /api/events//plus` Submits the snapshot of the event to Frigate+ for labeling. diff --git a/frigate/http.py b/frigate/http.py index 80784332d..ebae56af2 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -183,6 +183,23 @@ def set_retain(id): ) +@bp.route("/events//plus", methods=("DELETE",)) +def clear_plus(id): + try: + event = Event.get(Event.id == id) + except DoesNotExist: + return make_response( + jsonify({"success": False, "message": "Event " + id + " not found"}), 404 + ) + + event.plus_id = None + event.save() + + return make_response( + jsonify({"success": True, "message": "Event " + id + " plus_id cleared"}), 200 + ) + + @bp.route("/events//plus", methods=("POST",)) def send_to_plus(id): if not current_app.plus_api.is_active():