NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Endpoint for last clip (#9710)
vanseforge64f142a5dd26
diff --git a/docs/docs/integrations/api.md b/docs/docs/integrations/api.mdindex 41aba3b41f..510a8a3c8c 100644--- a/docs/docs/integrations/api.md+++ b/docs/docs/integrations/api.md@@ -237,6 +237,10 @@ Returns a thumbnail for the event id optimized for notifications. Works while thReturns the thumbnail from the latest event for the given camera and label combo. Using `any` as the label will return the latest thumbnail regardless of type.+### `GET /api/<camera_name>/<label>/clip.mp4`++Returns the clip from the latest event for the given camera and label combo. Using `any` as the label will return the latest clip regardless of type.+### `GET /api/events/<id>/clip.mp4`Returns the clip for the event id. Works after the event has ended.diff --git a/frigate/http.py b/frigate/http.pyindex 7f4bb058f4..7dbd20e57c 100644--- a/frigate/http.py+++ b/frigate/http.py@@ -864,6 +864,25 @@ def label_thumbnail(camera_name, label):return response[email protected]("/<camera_name>/<label>/clip.mp4")+def label_clip(camera_name, label):+ label = unquote(label)+ event_query = Event.select(fn.MAX(Event.id)).where(+ Event.camera == camera_name, Event.has_clip == True+ )+ if label != "any":+ event_query = event_query.where(Event.label == label)++ try:+ event = event_query.get()++ return event_clip(event)+ except DoesNotExist:+ return make_response(+ jsonify({"success": False, "message": "Event not found"}), 404+ )++@bp.route("/events/<id>/snapshot.jpg")def event_snapshot(id):download = request.args.get("download", type=bool)