mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 19:25:22 +03:00
skip creating model instances
This commit is contained in:
parent
bf6cb96f46
commit
a444714a5e
@ -590,9 +590,10 @@ def timeline():
|
|||||||
.where(reduce(operator.and_, clauses))
|
.where(reduce(operator.and_, clauses))
|
||||||
.order_by(Timeline.timestamp.asc())
|
.order_by(Timeline.timestamp.asc())
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
|
.dicts()
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonify([model_to_dict(t) for t in timeline])
|
return jsonify([t for t in timeline])
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/<camera_name>/<label>/best.jpg")
|
@bp.route("/<camera_name>/<label>/best.jpg")
|
||||||
@ -774,7 +775,6 @@ def events():
|
|||||||
favorites = request.args.get("favorites", type=int)
|
favorites = request.args.get("favorites", type=int)
|
||||||
|
|
||||||
clauses = []
|
clauses = []
|
||||||
excluded_fields = []
|
|
||||||
|
|
||||||
selected_columns = [
|
selected_columns = [
|
||||||
Event.id,
|
Event.id,
|
||||||
@ -859,9 +859,7 @@ def events():
|
|||||||
if in_progress is not None:
|
if in_progress is not None:
|
||||||
clauses.append((Event.end_time.is_null(in_progress)))
|
clauses.append((Event.end_time.is_null(in_progress)))
|
||||||
|
|
||||||
if not include_thumbnails:
|
if include_thumbnails:
|
||||||
excluded_fields.append(Event.thumbnail)
|
|
||||||
else:
|
|
||||||
selected_columns.append(Event.thumbnail)
|
selected_columns.append(Event.thumbnail)
|
||||||
|
|
||||||
if favorites:
|
if favorites:
|
||||||
@ -875,9 +873,10 @@ def events():
|
|||||||
.where(reduce(operator.and_, clauses))
|
.where(reduce(operator.and_, clauses))
|
||||||
.order_by(Event.start_time.desc())
|
.order_by(Event.start_time.desc())
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
|
.dicts()
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonify([model_to_dict(e, exclude=excluded_fields) for e in events])
|
return jsonify([e for e in events])
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/events/<camera_name>/<label>/create", methods=["POST"])
|
@bp.route("/events/<camera_name>/<label>/create", methods=["POST"])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user