mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Endpoint for last clip (#9710)
* Added endpoint for last clip * Update frigate/http.py Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Update docs/docs/integrations/api.md Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Update frigate/http.py Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Update frigate/http.py Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Formatted with ruff --------- Co-authored-by: Vader <info@vanse.de> Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
parent
5028a9632e
commit
64f142a5dd
@ -237,6 +237,10 @@ Returns a thumbnail for the event id optimized for notifications. Works while th
|
|||||||
|
|
||||||
Returns 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.
|
Returns 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`
|
### `GET /api/events/<id>/clip.mp4`
|
||||||
|
|
||||||
Returns the clip for the event id. Works after the event has ended.
|
Returns the clip for the event id. Works after the event has ended.
|
||||||
|
@ -864,6 +864,25 @@ def label_thumbnail(camera_name, label):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/<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")
|
@bp.route("/events/<id>/snapshot.jpg")
|
||||||
def event_snapshot(id):
|
def event_snapshot(id):
|
||||||
download = request.args.get("download", type=bool)
|
download = request.args.get("download", type=bool)
|
||||||
|
Loading…
Reference in New Issue
Block a user