mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +03:00
Fix serialization issues
This commit is contained in:
parent
55030c1655
commit
0e87dac646
@ -6,7 +6,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -15,6 +15,7 @@ from pydantic import (
|
|||||||
ConfigDict,
|
ConfigDict,
|
||||||
Field,
|
Field,
|
||||||
TypeAdapter,
|
TypeAdapter,
|
||||||
|
field_serializer,
|
||||||
field_validator,
|
field_validator,
|
||||||
validator,
|
validator,
|
||||||
)
|
)
|
||||||
@ -336,7 +337,11 @@ class MotionConfig(FrigateBaseModel):
|
|||||||
enabled_in_config: Optional[bool] = Field(
|
enabled_in_config: Optional[bool] = Field(
|
||||||
None, title="Keep track of original state of motion detection."
|
None, title="Keep track of original state of motion detection."
|
||||||
)
|
)
|
||||||
|
raw_mask: Union[str, List[str]] = ""
|
||||||
|
|
||||||
|
@field_serializer("mask", when_used="json")
|
||||||
|
def serialize_mask(self, value: Any, info):
|
||||||
|
return self.raw_mask
|
||||||
|
|
||||||
class RuntimeMotionConfig(MotionConfig):
|
class RuntimeMotionConfig(MotionConfig):
|
||||||
raw_mask: Union[str, List[str]] = ""
|
raw_mask: Union[str, List[str]] = ""
|
||||||
@ -364,6 +369,10 @@ class RuntimeMotionConfig(MotionConfig):
|
|||||||
ret.pop("raw_mask")
|
ret.pop("raw_mask")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@field_serializer("mask", when_used="json")
|
||||||
|
def serialize_mask(self, value: Any, info):
|
||||||
|
return self.raw_mask
|
||||||
|
|
||||||
model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore")
|
model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore")
|
||||||
|
|
||||||
|
|
||||||
@ -443,6 +452,11 @@ class FilterConfig(FrigateBaseModel):
|
|||||||
None,
|
None,
|
||||||
title="Detection area polygon mask for this filter configuration.",
|
title="Detection area polygon mask for this filter configuration.",
|
||||||
)
|
)
|
||||||
|
raw_mask: Union[str, List[str]] = ""
|
||||||
|
|
||||||
|
@field_serializer("mask", when_used="json")
|
||||||
|
def serialize_mask(self, value: Any, info):
|
||||||
|
return self.raw_mask
|
||||||
|
|
||||||
|
|
||||||
class AudioFilterConfig(FrigateBaseModel):
|
class AudioFilterConfig(FrigateBaseModel):
|
||||||
|
|||||||
@ -1384,7 +1384,7 @@ def end_event(event_id):
|
|||||||
|
|
||||||
@bp.route("/config")
|
@bp.route("/config")
|
||||||
def config():
|
def config():
|
||||||
config = current_app.frigate_config.model_dump()
|
config = current_app.frigate_config.model_dump(mode='json')
|
||||||
|
|
||||||
# remove the mqtt password
|
# remove the mqtt password
|
||||||
config["mqtt"].pop("password", None)
|
config["mqtt"].pop("password", None)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user