mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 16:42:18 +03:00
Use identifier field for unknown license plates (#17123)
* backend * backend fixes * api for search queries * frontend * docs * add filterable scroll list to more filters pane for identifiers * always publish identifier
This commit is contained in:
@@ -619,6 +619,39 @@ def get_sub_labels(split_joined: Optional[int] = None):
|
||||
return JSONResponse(content=sub_labels)
|
||||
|
||||
|
||||
@router.get("/identifiers")
|
||||
def get_identifiers(split_joined: Optional[int] = None):
|
||||
try:
|
||||
events = Event.select(Event.data).distinct()
|
||||
except Exception:
|
||||
return JSONResponse(
|
||||
content=({"success": False, "message": "Failed to get identifiers"}),
|
||||
status_code=404,
|
||||
)
|
||||
|
||||
identifiers = []
|
||||
for e in events:
|
||||
if e.data is not None and "identifier" in e.data:
|
||||
identifiers.append(e.data["identifier"])
|
||||
|
||||
while None in identifiers:
|
||||
identifiers.remove(None)
|
||||
|
||||
if split_joined:
|
||||
original_identifiers = identifiers.copy()
|
||||
for identifier in original_identifiers:
|
||||
if identifier and "," in identifier:
|
||||
identifiers.remove(identifier)
|
||||
parts = identifier.split(",")
|
||||
for part in parts:
|
||||
if part.strip() not in identifiers:
|
||||
identifiers.append(part.strip())
|
||||
|
||||
identifiers = list(set(identifiers))
|
||||
identifiers.sort()
|
||||
return JSONResponse(content=identifiers)
|
||||
|
||||
|
||||
@router.get("/timeline")
|
||||
def timeline(camera: str = "all", limit: int = 100, source_id: Optional[str] = None):
|
||||
clauses = []
|
||||
|
||||
Reference in New Issue
Block a user