mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-28 11:08:22 +03:00
Compare commits
3 Commits
465f2148e4
...
c66d80b672
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c66d80b672 | ||
|
|
ef5608a970 | ||
|
|
bf0d985b9d |
@ -56,7 +56,9 @@ def _is_valid_host(host: str) -> bool:
|
||||
|
||||
@router.get("/go2rtc/streams", dependencies=[Depends(allow_any_authenticated())])
|
||||
def go2rtc_streams():
|
||||
r = requests.get("http://127.0.0.1:1984/api/streams")
|
||||
r = requests.get(
|
||||
"http://127.0.0.1:1984/api/streams", proxies={"http": None, "https": None}
|
||||
)
|
||||
if not r.ok:
|
||||
logger.error("Failed to fetch streams from go2rtc")
|
||||
return JSONResponse(
|
||||
@ -75,7 +77,8 @@ def go2rtc_streams():
|
||||
)
|
||||
def go2rtc_camera_stream(request: Request, camera_name: str):
|
||||
r = requests.get(
|
||||
f"http://127.0.0.1:1984/api/streams?src={camera_name}&video=all&audio=allµphone"
|
||||
f"http://127.0.0.1:1984/api/streams?src={camera_name}&video=all&audio=allµphone",
|
||||
proxies={"http": None, "https": None},
|
||||
)
|
||||
if not r.ok:
|
||||
camera_config = request.app.frigate_config.cameras.get(camera_name)
|
||||
@ -107,6 +110,7 @@ def go2rtc_add_stream(request: Request, stream_name: str, src: str = ""):
|
||||
"http://127.0.0.1:1984/api/streams",
|
||||
params=params,
|
||||
timeout=10,
|
||||
proxies={"http": None, "https": None},
|
||||
)
|
||||
if not r.ok:
|
||||
logger.error(f"Failed to add go2rtc stream {stream_name}: {r.text}")
|
||||
@ -142,6 +146,7 @@ def go2rtc_delete_stream(stream_name: str):
|
||||
"http://127.0.0.1:1984/api/streams",
|
||||
params={"src": stream_name},
|
||||
timeout=10,
|
||||
proxies={"http": None, "https": None},
|
||||
)
|
||||
if not r.ok:
|
||||
logger.error(f"Failed to delete go2rtc stream {stream_name}: {r.text}")
|
||||
|
||||
@ -33,7 +33,6 @@ from frigate.config.camera.updater import (
|
||||
CameraConfigUpdateEnum,
|
||||
CameraConfigUpdateSubscriber,
|
||||
)
|
||||
from frigate.config.classification import ObjectClassificationType
|
||||
from frigate.const import (
|
||||
FAST_QUEUE_TIMEOUT,
|
||||
UPDATE_CAMERA_ACTIVITY,
|
||||
@ -760,16 +759,8 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
|
||||
self.update_mqtt_motion(camera, frame_time, motion_boxes)
|
||||
|
||||
attribute_model_names = [
|
||||
name
|
||||
for name, model_config in self.config.classification.custom.items()
|
||||
if model_config.object_config
|
||||
and model_config.object_config.classification_type
|
||||
== ObjectClassificationType.attribute
|
||||
]
|
||||
tracked_objects = [
|
||||
o.to_dict(attribute_model_names=attribute_model_names)
|
||||
for o in camera_state.tracked_objects.values()
|
||||
o.to_dict() for o in camera_state.tracked_objects.values()
|
||||
]
|
||||
|
||||
# publish info on this frame
|
||||
|
||||
@ -376,11 +376,15 @@ class TrackedObject:
|
||||
)
|
||||
return (thumb_update, significant_change, path_update, autotracker_update)
|
||||
|
||||
def to_dict(
|
||||
self,
|
||||
attribute_model_names: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
event = {
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
# Tracking internals excluded from output (centroid, estimate, estimate_velocity)
|
||||
_EXCLUDED_OBJ_DATA_KEYS = {
|
||||
"centroid",
|
||||
"estimate",
|
||||
"estimate_velocity",
|
||||
}
|
||||
|
||||
event: dict[str, Any] = {
|
||||
"id": self.obj_data["id"],
|
||||
"camera": self.camera_config.name,
|
||||
"frame_time": self.obj_data["frame_time"],
|
||||
@ -414,11 +418,11 @@ class TrackedObject:
|
||||
"path_data": self.path_data.copy(),
|
||||
"recognized_license_plate": self.obj_data.get("recognized_license_plate"),
|
||||
}
|
||||
if attribute_model_names is not None:
|
||||
for name in attribute_model_names:
|
||||
value = self.obj_data.get(name)
|
||||
if value is not None:
|
||||
event[name] = value
|
||||
|
||||
# Add any other obj_data keys (e.g. custom attribute fields) not yet included
|
||||
for key, value in self.obj_data.items():
|
||||
if key not in _EXCLUDED_OBJ_DATA_KEYS and key not in event:
|
||||
event[key] = value
|
||||
|
||||
return event
|
||||
|
||||
|
||||
@ -629,7 +629,11 @@ def auto_detect_hwaccel() -> str:
|
||||
try:
|
||||
cuda = False
|
||||
vaapi = False
|
||||
resp = requests.get("http://127.0.0.1:1984/api/ffmpeg/hardware", timeout=3)
|
||||
resp = requests.get(
|
||||
"http://127.0.0.1:1984/api/ffmpeg/hardware",
|
||||
timeout=3,
|
||||
proxies={"http": None, "https": None},
|
||||
)
|
||||
|
||||
if resp.status_code == 200:
|
||||
data: dict[str, list[dict[str, str]]] = resp.json()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user