mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 02:35:22 +03:00
Set name
This commit is contained in:
parent
f1c5659d1e
commit
11ffe07ae3
@ -174,6 +174,7 @@ class FrigateApp:
|
|||||||
self.stats_tracking,
|
self.stats_tracking,
|
||||||
self.detected_frames_processor,
|
self.detected_frames_processor,
|
||||||
self.storage_maintainer,
|
self.storage_maintainer,
|
||||||
|
self.onvif_controller,
|
||||||
self.plus_api,
|
self.plus_api,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ from frigate.const import CLIPS_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
|
|||||||
from frigate.models import Event, Recordings, Timeline
|
from frigate.models import Event, Recordings, Timeline
|
||||||
from frigate.object_processing import TrackedObject
|
from frigate.object_processing import TrackedObject
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
|
from frigate.ptz import OnvifController
|
||||||
from frigate.stats import stats_snapshot
|
from frigate.stats import stats_snapshot
|
||||||
from frigate.util import (
|
from frigate.util import (
|
||||||
clean_camera_user_pass,
|
clean_camera_user_pass,
|
||||||
@ -59,6 +60,7 @@ def create_app(
|
|||||||
stats_tracking,
|
stats_tracking,
|
||||||
detected_frames_processor,
|
detected_frames_processor,
|
||||||
storage_maintainer: StorageMaintainer,
|
storage_maintainer: StorageMaintainer,
|
||||||
|
onvif: OnvifController,
|
||||||
plus_api: PlusApi,
|
plus_api: PlusApi,
|
||||||
):
|
):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@ -77,6 +79,7 @@ def create_app(
|
|||||||
app.stats_tracking = stats_tracking
|
app.stats_tracking = stats_tracking
|
||||||
app.detected_frames_processor = detected_frames_processor
|
app.detected_frames_processor = detected_frames_processor
|
||||||
app.storage_maintainer = storage_maintainer
|
app.storage_maintainer = storage_maintainer
|
||||||
|
app.onvif = onvif
|
||||||
app.plus_api = plus_api
|
app.plus_api = plus_api
|
||||||
app.camera_error_image = None
|
app.camera_error_image = None
|
||||||
app.hwaccel_errors = []
|
app.hwaccel_errors = []
|
||||||
@ -994,6 +997,14 @@ def mjpeg_feed(camera_name):
|
|||||||
return "Camera named {} not found".format(camera_name), 404
|
return "Camera named {} not found".format(camera_name), 404
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/<camera_name>/ptz/info")
|
||||||
|
def camera_ptz_info(camera_name):
|
||||||
|
if camera_name in current_app.frigate_config.cameras:
|
||||||
|
return jsonify(current_app.onvif.get_camera_info(camera_name))
|
||||||
|
else:
|
||||||
|
return "Camera named {} not found".format(camera_name), 404
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/<camera_name>/latest.jpg")
|
@bp.route("/<camera_name>/latest.jpg")
|
||||||
def latest_frame(camera_name):
|
def latest_frame(camera_name):
|
||||||
draw_options = {
|
draw_options = {
|
||||||
|
|||||||
@ -65,7 +65,15 @@ class OnvifController:
|
|||||||
|
|
||||||
# get list of supported features
|
# get list of supported features
|
||||||
ptz_config = ptz.GetConfigurationOptions(request)
|
ptz_config = ptz.GetConfigurationOptions(request)
|
||||||
logger.error(f"ptz config is {ptz_config}")
|
supported_features = []
|
||||||
|
|
||||||
|
if ptz_config.get("Spaces", {}).get("ContinuousPanTiltVelocitySpace"):
|
||||||
|
supported_features.append("pt")
|
||||||
|
|
||||||
|
if ptz_config.get("Spaces", {}).get("ContinuousZoomVelocitySpace"):
|
||||||
|
supported_features.append("zoom")
|
||||||
|
|
||||||
|
self.cams[camera_name]["features"] = supported_features
|
||||||
|
|
||||||
self.cams[camera_name]["init"] = True
|
self.cams[camera_name]["init"] = True
|
||||||
|
|
||||||
@ -171,3 +179,17 @@ class OnvifController:
|
|||||||
self._zoom(camera_name, command)
|
self._zoom(camera_name, command)
|
||||||
else:
|
else:
|
||||||
self._move(camera_name, command)
|
self._move(camera_name, command)
|
||||||
|
|
||||||
|
def get_camera_info(self, camera_name: str) -> dict[str, any]:
|
||||||
|
if camera_name not in self.cams.keys():
|
||||||
|
logger.error(f"Onvif is not setup for {camera_name}")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
if not self.cams[camera_name]["init"]:
|
||||||
|
self._init_onvif(camera_name)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"name": camera_name,
|
||||||
|
"features": self.cams[camera_name]["feautres"],
|
||||||
|
"presets": self.cams[camera_name]["presets"].keys(),
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user