mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-30 13:48:07 +02:00
Cleanup typing (#17145)
This commit is contained in:
parent
8a17e2bfbf
commit
759d963a04
@ -27,6 +27,7 @@ from frigate.api.defs.query.media_query_parameters import (
|
|||||||
MediaRecordingsSummaryQueryParams,
|
MediaRecordingsSummaryQueryParams,
|
||||||
)
|
)
|
||||||
from frigate.api.defs.tags import Tags
|
from frigate.api.defs.tags import Tags
|
||||||
|
from frigate.camera.state import CameraState
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
@ -765,31 +766,36 @@ def event_snapshot(
|
|||||||
except DoesNotExist:
|
except DoesNotExist:
|
||||||
# see if the object is currently being tracked
|
# see if the object is currently being tracked
|
||||||
try:
|
try:
|
||||||
camera_states = request.app.detected_frames_processor.camera_states.values()
|
camera_states: list[CameraState] = (
|
||||||
|
request.app.detected_frames_processor.camera_states.values()
|
||||||
|
)
|
||||||
for camera_state in camera_states:
|
for camera_state in camera_states:
|
||||||
if event_id in camera_state.tracked_objects:
|
if event_id in camera_state.tracked_objects:
|
||||||
tracked_obj = camera_state.tracked_objects.get(event_id)
|
tracked_obj = camera_state.tracked_objects.get(event_id)
|
||||||
if tracked_obj is not None:
|
if tracked_obj is not None:
|
||||||
jpg_bytes = tracked_obj.get_jpg_bytes(
|
jpg_bytes = tracked_obj.get_img_bytes(
|
||||||
|
ext="jpg",
|
||||||
timestamp=params.timestamp,
|
timestamp=params.timestamp,
|
||||||
bounding_box=params.bbox,
|
bounding_box=params.bbox,
|
||||||
crop=params.crop,
|
crop=params.crop,
|
||||||
height=params.height,
|
height=params.height,
|
||||||
quality=params.quality,
|
quality=params.quality,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
content={"success": False, "message": "Event not found"},
|
content={"success": False, "message": f"Ongoing event not found: {e}"},
|
||||||
status_code=404,
|
status_code=404,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
content={"success": False, "message": "Event not found"}, status_code=404
|
content={"success": False, "message": f"Unknown error occurred: {e}"},
|
||||||
|
status_code=404,
|
||||||
)
|
)
|
||||||
|
|
||||||
if jpg_bytes is None:
|
if jpg_bytes is None:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
content={"success": False, "message": "Event not found"}, status_code=404
|
content={"success": False, "message": "Live frame not available"},
|
||||||
|
status_code=404,
|
||||||
)
|
)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
Loading…
Reference in New Issue
Block a user