mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 17:14:26 +03:00
config file changes
This commit is contained in:
parent
ed9c67804a
commit
952495f1af
@ -1,3 +1,5 @@
|
|||||||
|
from typing import Dict
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from ..base import FrigateBaseModel
|
from ..base import FrigateBaseModel
|
||||||
@ -6,6 +8,9 @@ __all__ = ["CameraLiveConfig"]
|
|||||||
|
|
||||||
|
|
||||||
class CameraLiveConfig(FrigateBaseModel):
|
class CameraLiveConfig(FrigateBaseModel):
|
||||||
stream_name: str = Field(default="", title="Name of restream to use as live view.")
|
streams: Dict[str, str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
title="Friendly names and restream names to use for live view.",
|
||||||
|
)
|
||||||
height: int = Field(default=720, title="Live camera view height")
|
height: int = Field(default=720, title="Live camera view height")
|
||||||
quality: int = Field(default=8, ge=1, le=31, title="Live camera view quality")
|
quality: int = Field(default=8, ge=1, le=31, title="Live camera view quality")
|
||||||
|
|||||||
@ -176,16 +176,17 @@ def verify_config_roles(camera_config: CameraConfig) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def verify_valid_live_stream_name(
|
def verify_valid_live_stream_names(
|
||||||
frigate_config: FrigateConfig, camera_config: CameraConfig
|
frigate_config: FrigateConfig, camera_config: CameraConfig
|
||||||
) -> ValueError | None:
|
) -> ValueError | None:
|
||||||
"""Verify that a restream exists to use for live view."""
|
"""Verify that a restream exists to use for live view."""
|
||||||
|
for _, stream_name in camera_config.live.streams.items():
|
||||||
if (
|
if (
|
||||||
camera_config.live.stream_name
|
stream_name
|
||||||
not in frigate_config.go2rtc.model_dump().get("streams", {}).keys()
|
not in frigate_config.go2rtc.model_dump().get("streams", {}).keys()
|
||||||
):
|
):
|
||||||
return ValueError(
|
return ValueError(
|
||||||
f"No restream with name {camera_config.live.stream_name} exists for camera {camera_config.name}."
|
f"No restream with name {stream_name} exists for camera {camera_config.name}."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -558,15 +559,15 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
zone.generate_contour(camera_config.frame_shape)
|
zone.generate_contour(camera_config.frame_shape)
|
||||||
|
|
||||||
# Set live view stream if none is set
|
# Set live view stream if none is set
|
||||||
if not camera_config.live.stream_name:
|
if not camera_config.live.streams:
|
||||||
camera_config.live.stream_name = name
|
camera_config.live.streams = {name: name}
|
||||||
|
|
||||||
# generate the ffmpeg commands
|
# generate the ffmpeg commands
|
||||||
camera_config.create_ffmpeg_cmds()
|
camera_config.create_ffmpeg_cmds()
|
||||||
self.cameras[name] = camera_config
|
self.cameras[name] = camera_config
|
||||||
|
|
||||||
verify_config_roles(camera_config)
|
verify_config_roles(camera_config)
|
||||||
verify_valid_live_stream_name(self, camera_config)
|
verify_valid_live_stream_names(self, camera_config)
|
||||||
verify_recording_retention(camera_config)
|
verify_recording_retention(camera_config)
|
||||||
verify_recording_segments_setup_with_reasonable_time(camera_config)
|
verify_recording_segments_setup_with_reasonable_time(camera_config)
|
||||||
verify_zone_objects_are_tracked(camera_config)
|
verify_zone_objects_are_tracked(camera_config)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user