blakeblackshear.frigate/frigate
Sean Vig 84a0827aee Use dataclasses for config handling
Use config data classes to eliminate some of the boilerplate associated
with setting up the configuration.  In particular, using dataclasses
removes a lot of the boilerplate around assigning properties to the
object and allows these to be easily immutable by freezing them.  In the
case of simple, non-nested dataclasses, this also provides more
convenient `asdict` helpers.

To set this up, where previously the objects would be parsed from the
config via the `__init__` method, create a `build` classmethod that does
this and calls the dataclass initializer.

Some of the objects are mutated at runtime, in particular some of the
zones are mutated to set the color (this might be able to be refactored
out) and some of the camera functionality can be enabled/disabled.  Some
of the configs with `enabled` properties don't seem to have mqtt hooks
to be able to toggle this, in particular, the clips, snapshots, and
detect can be toggled but rtmp and record configs do not, but all of
these configs are still not frozen in case there is some other
functionality I am missing.

There are a couple other minor fixes here, one that was introduced
by me recently where `max_seconds` was not defined, the other to
properly `get()` the message payload when handling publishing mqtt
messages sent via websocket.
2021-05-23 20:38:57 -05:00
..
test Use dataclasses for config handling 2021-05-23 20:38:57 -05:00
__init__.py
__main__.py formatting cleanup 2021-02-25 07:01:57 -06:00
app.py Add support for NGINX VOD Module 2021-05-22 07:48:44 -05:00
config.py Use dataclasses for config handling 2021-05-23 20:38:57 -05:00
const.py formatting cleanup 2021-02-25 07:01:57 -06:00
edgetpu.py Wait on stop event when possible 2021-05-22 07:54:16 -05:00
events.py Use dataclasses for config handling 2021-05-23 20:38:57 -05:00
http.py fixes 2021-05-23 08:21:18 -05:00
log.py Add support for NGINX VOD Module 2021-05-22 07:48:44 -05:00
models.py
motion.py formatting cleanup 2021-02-25 07:01:57 -06:00
mqtt.py Use dataclasses for config handling 2021-05-23 20:38:57 -05:00
object_processing.py Wait on stop event when possible 2021-05-22 07:54:16 -05:00
objects.py Improve handling of object matching 2021-05-22 08:04:38 -05:00
process_clip.py Improve ffprobe executions 2021-05-22 07:48:00 -05:00
record.py Wait on stop event when possible 2021-05-22 07:54:16 -05:00
stats.py Wait on stop event when possible 2021-05-22 07:54:16 -05:00
util.py formatting cleanup 2021-02-25 07:01:57 -06:00
video.py Use dataclasses for config handling 2021-05-23 20:38:57 -05:00
watchdog.py Wait on stop event when possible 2021-05-22 07:54:16 -05:00
zeroconf.py formatting cleanup 2021-02-25 07:01:57 -06:00