mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +01:00
bbbb3b4a06
* Replace logging.warn with logging.warning * Install config global state early * Split config.py into more manageable pieces
26 lines
683 B
Python
26 lines
683 B
Python
from typing import Union
|
|
|
|
from pydantic import Field, field_validator
|
|
|
|
from .base import FrigateBaseModel
|
|
|
|
__all__ = ["CameraGroupConfig"]
|
|
|
|
|
|
class CameraGroupConfig(FrigateBaseModel):
|
|
"""Represents a group of cameras."""
|
|
|
|
cameras: Union[str, list[str]] = Field(
|
|
default_factory=list, title="List of cameras in this group."
|
|
)
|
|
icon: str = Field(default="generic", title="Icon that represents camera group.")
|
|
order: int = Field(default=0, title="Sort order for group.")
|
|
|
|
@field_validator("cameras", mode="before")
|
|
@classmethod
|
|
def validate_cameras(cls, v):
|
|
if isinstance(v, str) and "," not in v:
|
|
return [v]
|
|
|
|
return v
|