mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 12:15:25 +03:00
Added endpoint for last clip
This commit is contained in:
parent
f6a4c2a7b3
commit
b838f389f6
@ -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>/last_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.
|
||||||
|
|||||||
@ -834,6 +834,22 @@ def label_thumbnail(camera_name, label):
|
|||||||
response.headers["Cache-Control"] = "no-store"
|
response.headers["Cache-Control"] = "no-store"
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@bp.route("/<camera_name>/<label>/last_clip.mp4")
|
||||||
|
def label_last_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.scalar()
|
||||||
|
|
||||||
|
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):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user