mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
change if-logic, obsolete copy, info disabled cam
This commit is contained in:
parent
ffbfc9fb16
commit
cb88ff134c
@ -62,7 +62,6 @@ detectors:
|
|||||||
|
|
||||||
cameras:
|
cameras:
|
||||||
camera_1: # <------ Name the camera
|
camera_1: # <------ Name the camera
|
||||||
enabled: True # <----- Enable/disable camera
|
|
||||||
ffmpeg:
|
ffmpeg:
|
||||||
inputs:
|
inputs:
|
||||||
- path: rtsp://10.0.10.10:554/rtsp # <----- Update for your camera
|
- path: rtsp://10.0.10.10:554/rtsp # <----- Update for your camera
|
||||||
|
|||||||
@ -250,7 +250,10 @@ class FrigateApp:
|
|||||||
def start_camera_processors(self) -> None:
|
def start_camera_processors(self) -> None:
|
||||||
model_shape = (self.config.model.height, self.config.model.width)
|
model_shape = (self.config.model.height, self.config.model.width)
|
||||||
for name, config in self.config.cameras.items():
|
for name, config in self.config.cameras.items():
|
||||||
if self.config.cameras[name].enabled:
|
if not self.config.cameras[name].enabled:
|
||||||
|
logger.info(f"Camera processor not started for disabled camera {name}")
|
||||||
|
continue
|
||||||
|
|
||||||
camera_process = mp.Process(
|
camera_process = mp.Process(
|
||||||
target=track_camera,
|
target=track_camera,
|
||||||
name=f"camera_processor:{name}",
|
name=f"camera_processor:{name}",
|
||||||
@ -269,12 +272,13 @@ class FrigateApp:
|
|||||||
self.camera_metrics[name]["process"] = camera_process
|
self.camera_metrics[name]["process"] = camera_process
|
||||||
camera_process.start()
|
camera_process.start()
|
||||||
logger.info(f"Camera processor started for {name}: {camera_process.pid}")
|
logger.info(f"Camera processor started for {name}: {camera_process.pid}")
|
||||||
else:
|
|
||||||
logger.info(f"Camera processor not started for disabled camera {name}")
|
|
||||||
|
|
||||||
def start_camera_capture_processes(self) -> None:
|
def start_camera_capture_processes(self) -> None:
|
||||||
for name, config in self.config.cameras.items():
|
for name, config in self.config.cameras.items():
|
||||||
if self.config.cameras[name].enabled:
|
if not self.config.cameras[name].enabled:
|
||||||
|
logger.info(f"Capture process not started for disabled camera {name}")
|
||||||
|
continue
|
||||||
|
|
||||||
capture_process = mp.Process(
|
capture_process = mp.Process(
|
||||||
target=capture_camera,
|
target=capture_camera,
|
||||||
name=f"camera_capture:{name}",
|
name=f"camera_capture:{name}",
|
||||||
@ -284,8 +288,6 @@ class FrigateApp:
|
|||||||
self.camera_metrics[name]["capture_process"] = capture_process
|
self.camera_metrics[name]["capture_process"] = capture_process
|
||||||
capture_process.start()
|
capture_process.start()
|
||||||
logger.info(f"Capture process started for {name}: {capture_process.pid}")
|
logger.info(f"Capture process started for {name}: {capture_process.pid}")
|
||||||
else:
|
|
||||||
logger.info(f"Capture process not started for disabled camera {name}")
|
|
||||||
|
|
||||||
def start_event_processor(self) -> None:
|
def start_event_processor(self) -> None:
|
||||||
self.event_processor = EventProcessor(
|
self.event_processor = EventProcessor(
|
||||||
|
|||||||
@ -817,7 +817,7 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
exclude_unset=True,
|
exclude_unset=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
for name, camera in config.cameras.copy().items():
|
for name, camera in config.cameras.items():
|
||||||
merged_config = deep_merge(camera.dict(exclude_unset=True), global_config)
|
merged_config = deep_merge(camera.dict(exclude_unset=True), global_config)
|
||||||
camera_config: CameraConfig = CameraConfig.parse_obj(
|
camera_config: CameraConfig = CameraConfig.parse_obj(
|
||||||
{"name": name, **merged_config}
|
{"name": name, **merged_config}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export default function CameraImage({ camera, onload, searchParams = '', stretch
|
|||||||
const [{ width: availableWidth }] = useResizeObserver(containerRef);
|
const [{ width: availableWidth }] = useResizeObserver(containerRef);
|
||||||
|
|
||||||
const { name } = config ? config.cameras[camera] : '';
|
const { name } = config ? config.cameras[camera] : '';
|
||||||
|
const enabled = config ? config.cameras[camera].enabled : 'True';
|
||||||
const { width, height } = config ? config.cameras[camera].detect : { width: 1, height: 1 };
|
const { width, height } = config ? config.cameras[camera].detect : { width: 1, height: 1 };
|
||||||
const aspectRatio = width / height;
|
const aspectRatio = width / height;
|
||||||
|
|
||||||
@ -45,12 +46,18 @@ export default function CameraImage({ camera, onload, searchParams = '', stretch
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full" ref={containerRef}>
|
<div className="relative w-full" ref={containerRef}>
|
||||||
|
{
|
||||||
|
(enabled) ?
|
||||||
<canvas data-testid="cameraimage-canvas" height={scaledHeight} ref={canvasRef} width={scaledWidth} />
|
<canvas data-testid="cameraimage-canvas" height={scaledHeight} ref={canvasRef} width={scaledWidth} />
|
||||||
{!hasLoaded ? (
|
: <div class="text-center text-green-500">Camera is disabled in config, no stream or snapshot available!</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(!hasLoaded && enabled) ? (
|
||||||
<div className="absolute inset-0 flex justify-center" style={`height: ${scaledHeight}px`}>
|
<div className="absolute inset-0 flex justify-center" style={`height: ${scaledHeight}px`}>
|
||||||
<ActivityIndicator />
|
<ActivityIndicator />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null
|
||||||
</div>
|
}
|
||||||
|
</div >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user