mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 19:55:26 +03:00
Adjust timeline api to include metadata and before
This commit is contained in:
parent
38fd5cd45e
commit
7b649a5a19
@ -615,6 +615,7 @@ def timeline():
|
|||||||
def hourly_timeline():
|
def hourly_timeline():
|
||||||
"""Get hourly summary for timeline."""
|
"""Get hourly summary for timeline."""
|
||||||
camera = request.args.get("camera", "all")
|
camera = request.args.get("camera", "all")
|
||||||
|
before = request.args.get("before", type=float)
|
||||||
limit = request.args.get("limit", 200)
|
limit = request.args.get("limit", 200)
|
||||||
tz_name = request.args.get("timezone", default="utc", type=str)
|
tz_name = request.args.get("timezone", default="utc", type=str)
|
||||||
_, minute_modifier, _ = get_tz_modifiers(tz_name)
|
_, minute_modifier, _ = get_tz_modifiers(tz_name)
|
||||||
@ -624,6 +625,9 @@ def hourly_timeline():
|
|||||||
if camera != "all":
|
if camera != "all":
|
||||||
clauses.append((Timeline.camera == camera))
|
clauses.append((Timeline.camera == camera))
|
||||||
|
|
||||||
|
if before:
|
||||||
|
clauses.append((Timeline.timestamp < before))
|
||||||
|
|
||||||
if len(clauses) == 0:
|
if len(clauses) == 0:
|
||||||
clauses.append((True))
|
clauses.append((True))
|
||||||
|
|
||||||
@ -659,7 +663,14 @@ def hourly_timeline():
|
|||||||
else:
|
else:
|
||||||
hours[hour].insert(0, t)
|
hours[hour].insert(0, t)
|
||||||
|
|
||||||
return jsonify(hours)
|
return jsonify(
|
||||||
|
{
|
||||||
|
"start": timeline[0].timestamp,
|
||||||
|
"end": timeline[-1].timestamp,
|
||||||
|
"count": timeline.count(),
|
||||||
|
"hours": hours,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/<camera_name>/<label>/best.jpg")
|
@bp.route("/<camera_name>/<label>/best.jpg")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user