Files
leccelecce ec7040bed5 Enable event snapshot API to honour query params after event ends (#22375)
* Enable event snapshot API to honour query params

* fix unused imports

* Fixes

* Run ruff check --fix

* Web changes

* Further config and web fixes

* Further docs tweak

* Fix missing quality default in MediaEventsSnapshotQueryParams

* Manual events: don't save annotated jpeg; store frame time

* Remove unnecessary grayscale helper

* Add caveat to docs on snapshot_frame_time pre-0.18

* JPG snapshot should not be treated as clean

* Ensure tracked details uses uncropped, bbox'd snapshot

* Ensure all UI pages / menu actions use uncropped, bbox'd

* web lint

* Add missed config helper text

* Expect  SnapshotsConfig not Any

* docs: Remove pre-0.18 note

* Specify timestamp=0 in the UI

* Move tests out of http media

* Correct missed settings.json wording

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Revert to default None for quality

* Correct camera snapshot config wording

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Fix quality=0 handling

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Fix quality=0 handling #2

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* ReRun generate_config_translations

---------

Co-authored-by: leccelecce <example@example.com>
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2026-03-22 13:33:04 -06:00

72 lines
2.3 KiB
Python

from typing import Optional
from pydantic import Field
from ..base import FrigateBaseModel
from .record import RetainModeEnum
__all__ = ["SnapshotsConfig", "RetainConfig"]
class RetainConfig(FrigateBaseModel):
default: float = Field(
default=10,
title="Default retention",
description="Default number of days to retain snapshots.",
)
mode: RetainModeEnum = Field(
default=RetainModeEnum.motion,
title="Retention mode",
description="Mode for retention: all (save all segments), motion (save segments with motion), or active_objects (save segments with active objects).",
)
objects: dict[str, float] = Field(
default_factory=dict,
title="Object retention",
description="Per-object overrides for snapshot retention days.",
)
class SnapshotsConfig(FrigateBaseModel):
enabled: bool = Field(
default=False,
title="Enable snapshots",
description="Enable or disable saving snapshots for all cameras; can be overridden per-camera.",
)
timestamp: bool = Field(
default=False,
title="Timestamp overlay",
description="Overlay a timestamp on snapshots from API.",
)
bounding_box: bool = Field(
default=True,
title="Bounding box overlay",
description="Draw bounding boxes for tracked objects on snapshots from API.",
)
crop: bool = Field(
default=False,
title="Crop snapshot",
description="Crop snapshots from API to the detected object's bounding box.",
)
required_zones: list[str] = Field(
default_factory=list,
title="Required zones",
description="Zones an object must enter for a snapshot to be saved.",
)
height: Optional[int] = Field(
default=None,
title="Snapshot height",
description="Height (pixels) to resize snapshots from API to; leave empty to preserve original size.",
)
retain: RetainConfig = Field(
default_factory=RetainConfig,
title="Snapshot retention",
description="Retention settings for snapshots including default days and per-object overrides.",
)
quality: int = Field(
default=60,
title="Snapshot quality",
description="Encode quality for saved snapshots (0-100).",
ge=0,
le=100,
)