mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Simplified If-block and removed wrong Optional
This commit is contained in:
parent
1fe6236f0c
commit
52ac65a911
@ -530,7 +530,7 @@ class CameraUiConfig(FrigateBaseModel):
|
||||
|
||||
class CameraConfig(FrigateBaseModel):
|
||||
name: Optional[str] = Field(title="Camera name.", regex="^[a-zA-Z0-9_-]+$")
|
||||
enabled: Optional[bool] = Field(default=True, title="Enable camera.")
|
||||
enabled: bool = Field(default=True, title="Enable camera.")
|
||||
ffmpeg: CameraFfmpegConfig = Field(title="FFmpeg configuration for the camera.")
|
||||
best_image_timeout: int = Field(
|
||||
default=60,
|
||||
@ -823,7 +823,10 @@ class FrigateConfig(FrigateBaseModel):
|
||||
{"name": name, **merged_config}
|
||||
)
|
||||
|
||||
if camera_config.enabled:
|
||||
if not camera_config.enabled:
|
||||
config.cameras.pop(name)
|
||||
continue
|
||||
|
||||
# Default max_disappeared configuration
|
||||
max_disappeared = camera_config.detect.fps * 5
|
||||
if camera_config.detect.max_disappeared is None:
|
||||
@ -901,9 +904,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
"The 'retain_days' config option has been DEPRECATED and will be removed in a future version. Please use the 'days' setting under 'retain'"
|
||||
)
|
||||
if camera_config.record.retain.days == 0:
|
||||
camera_config.record.retain.days = (
|
||||
camera_config.record.retain_days
|
||||
)
|
||||
camera_config.record.retain.days = camera_config.record.retain_days
|
||||
|
||||
# warning if the higher level record mode is potentially more restrictive than the events
|
||||
rank_map = {
|
||||
@ -922,8 +923,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
# generate the ffmpeg commands
|
||||
camera_config.create_ffmpeg_cmds()
|
||||
config.cameras[name] = camera_config
|
||||
else:
|
||||
config.cameras.pop(name)
|
||||
return config
|
||||
|
||||
@validator("cameras")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user