feat: manage saved thumbnail plans and select plans for tasks
Community checks / verify (push) Skipped
Verify Frame Flow / verify (push) Failing after 5m58s

This commit is contained in:
渡口浪人
2026-10-23 14:47:27 +08:00
parent d94031eb50
commit 7178235022
17 changed files with 1736 additions and 37 deletions
+13
View File
@@ -107,6 +107,8 @@ Content = Annotated[
class Options(StrictModel):
generate_thumbnail: bool = True
thumbnail_plan_id: str | None = Field(default=None, pattern=r"^[a-f0-9]{32}$")
cleanup_unstarred: bool = False
duration: int = Field(default=0, ge=0, le=604800)
restore_previous: bool = False
@@ -281,6 +283,8 @@ class RestoreContent(StrictModel):
class JobInput(StrictModel):
generate_thumbnail: bool = False
thumbnail_plan_id: str | None = Field(default=None, pattern=r"^[a-f0-9]{32}$")
cleanup_unstarred: bool = False
enabled: bool = True
device_id: str = "living-room"
@@ -293,6 +297,15 @@ class JobInput(StrictModel):
@model_validator(mode="after")
def validate_options(self):
if self.generate_thumbnail and (
not self.thumbnail_plan_id
or not isinstance(self.source, PhotoSourceContent)
):
raise ValueError(
"Thumbnail generation requires a photo source and one saved plan"
)
if not self.generate_thumbnail and self.thumbnail_plan_id:
raise ValueError("Enable thumbnail generation before selecting a plan")
if self.cleanup_unstarred and not (
isinstance(self.source, PhotoSourceContent) and self.source.item_id is None
):