Added filter for submitted events

This commit is contained in:
tpjanssen 2023-10-06 16:18:50 +02:00
parent 4b2eb2083d
commit a93eb21fab
2 changed files with 24 additions and 16 deletions

View File

@ -156,7 +156,7 @@ Version info
Events from the database. Accepts the following query string parameters:
| param | Type | Description |
| -------------------- | ----- | ----------------------------------------------- |
| -------------------- | ----- | ----------------------------------------------------- |
| `before` | int | Epoch time |
| `after` | int | Epoch time |
| `cameras` | str | , separated list of cameras |
@ -171,6 +171,7 @@ Events from the database. Accepts the following query string parameters:
| `timezone` | str | Timezone to use for time range |
| `min_score` | float | Minimum score of the event |
| `max_score` | float | Maximum score of the event |
| `is_submitted` | int | Filter events that are submitted to Frigate+ (0 or 1) |
### `GET /api/timeline`

View File

@ -779,6 +779,7 @@ def events():
favorites = request.args.get("favorites", type=int)
min_score = request.args.get("min_score", type=float)
max_score = request.args.get("max_score", type=float)
is_submitted = request.args.get("is_submitted", type=int)
clauses = []
@ -907,6 +908,12 @@ def events():
if min_score is not None:
clauses.append((Event.data["score"] >= min_score))
if is_submitted is not None:
if is_submitted == 0:
clauses.append((Event.plus_id.is_null()))
else:
clauses.append((Event.plus_id != ""))
if len(clauses) == 0:
clauses.append((True))