mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Add in_progress parameter to /api/events to filter the results. (#5013)
* Add in_progress parameter to /api/events to filter the results. * Change in_progress to default to no filtering, 0 means no in progress, 1 means only in progress. * Fix code format with black. * Clear blank line.
This commit is contained in:
parent
cb0c5c2587
commit
731db8fb8f
@ -166,6 +166,7 @@ Events from the database. Accepts the following query string parameters:
|
|||||||
| `has_snapshot` | int | Filter to events that have snapshots (0 or 1) |
|
| `has_snapshot` | int | Filter to events that have snapshots (0 or 1) |
|
||||||
| `has_clip` | int | Filter to events that have clips (0 or 1) |
|
| `has_clip` | int | Filter to events that have clips (0 or 1) |
|
||||||
| `include_thumbnails` | int | Include thumbnails in the response (0 or 1) |
|
| `include_thumbnails` | int | Include thumbnails in the response (0 or 1) |
|
||||||
|
| `in_progress` | int | Limit to events in progress (0 or 1) |
|
||||||
|
|
||||||
### `GET /api/events/summary`
|
### `GET /api/events/summary`
|
||||||
|
|
||||||
|
@ -565,6 +565,7 @@ def events():
|
|||||||
before = request.args.get("before", type=float)
|
before = request.args.get("before", type=float)
|
||||||
has_clip = request.args.get("has_clip", type=int)
|
has_clip = request.args.get("has_clip", type=int)
|
||||||
has_snapshot = request.args.get("has_snapshot", type=int)
|
has_snapshot = request.args.get("has_snapshot", type=int)
|
||||||
|
in_progress = request.args.get("in_progress", type=int)
|
||||||
include_thumbnails = request.args.get("include_thumbnails", default=1, type=int)
|
include_thumbnails = request.args.get("include_thumbnails", default=1, type=int)
|
||||||
favorites = request.args.get("favorites", type=int)
|
favorites = request.args.get("favorites", type=int)
|
||||||
|
|
||||||
@ -642,6 +643,9 @@ def events():
|
|||||||
if not has_snapshot is None:
|
if not has_snapshot is None:
|
||||||
clauses.append((Event.has_snapshot == has_snapshot))
|
clauses.append((Event.has_snapshot == has_snapshot))
|
||||||
|
|
||||||
|
if not in_progress is None:
|
||||||
|
clauses.append((Event.end_time.is_null(in_progress)))
|
||||||
|
|
||||||
if not include_thumbnails:
|
if not include_thumbnails:
|
||||||
excluded_fields.append(Event.thumbnail)
|
excluded_fields.append(Event.thumbnail)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user