Commit Graph

747 Commits

Author SHA1 Message Date
Sean Vig
abbc608ee4 Updates to object processing
Lock updates to tracked objects, current frame time, motion boxes, and
regions on `update()`.

Directly create Counters using counted values.

Don't convert removed_ids, new_ids, or updated_ids sets to lists.

Update defaultdict's to remove un-necessary lambdas when possible.

When possible, drop un-necessay list comprehensions, such as when
calling `any`.

Use set comprehension, rather than passing a list comprehension into
`set()`.

Do the slightly more pythonic `x not in y` rather than `not x in y` to
check list inclusion.
2021-05-23 21:00:56 -05:00
Sean Vig
9634ec8e31 Allow zone configs to be frozen
Set the color at construction so the zone config objects can be frozen
2021-05-23 20:38:57 -05:00
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
Blake Blackshear
1fbcf4d9b9 fixes 2021-05-23 08:21:18 -05:00
Sean Vig
80f8256422 Improve handling of object matching
Use `np.unique` to determine the correct set of row/col pairs to iterate
over when doing the object matching without needing to track which rows
or columns have already been seen.  Add to some of the accompanying
documentation to clarify this algorithm.

Also fix what looks to be an erroneous early return, and change this to
a continue.
2021-05-22 08:04:38 -05:00
Sean Vig
57864f2be6 Wait on stop event when possible
Generally eliminate the `while True` loops while waiting for a stop
event and prefer to condition the loops on if the stop event is set,
blocking on that where it makes sense.  This generally comes in 3
flavors.  First and simplest, when there is a sleep and the stop event
is the only thing the loop blocks on, instead do a check using
`stop_event.wait(timeout)` to instead block on the stop event for the
designated amount of time. Second, when there is a different event that
is blocking in the loop, condition the loop on `stop_event.is_set()`
rather than breaking when it is set. Finally, when there is a separate
internal condition that requires a counter, have the loop iterate over
the counter and use `if stop_event.wait(timeout)` internal to the loop.
2021-05-22 07:54:16 -05:00
Jason Hunter
f4bc68d396 update HTTP API docs 2021-05-22 07:48:44 -05:00
Jason Hunter
926eec3c65 add --push so the images actually get published for nginx since they are not saved locally 2021-05-22 07:48:44 -05:00
Jason Hunter
abc6bbe7e0 Add nginx build arg for other architectures 2021-05-22 07:48:44 -05:00
Jason Hunter
acdfd1ccc4 remove comments from nginx.conf 2021-05-22 07:48:44 -05:00
Jason Hunter
315a13e1ce Make command has to be different than directory 2021-05-22 07:48:44 -05:00
Jason Hunter
aab6a00e4c Add support for NGINX VOD Module 2021-05-22 07:48:44 -05:00
Sean Vig
a4e6d9ed9a Improve ffprobe executions
When running ffprobe, use `subprocess.run` rather than
`subprocess.Popen`.  This simplifies the handling that is needed to run
and process the outputs.  Here, filename parsing is also simplified by
explicitly removing the file extension with `os.path.splitext` and
forcing a single split into the camera name and the formatted date.
2021-05-22 07:48:00 -05:00
Mitch Ross
ebb6d348a3
feat(web): Delete events from Event page and API (#991)
Co-authored-by: Scott Roach <scott@thinkpivot.io>
Co-authored-by: Paul Armstrong <paul@spaceyak.com>
2021-05-12 08:19:02 -07:00
Jason Hunter
482399d82f allow logger daemon process to be killed with the main thread, thus allowing us to continue logging during shutdown 2021-05-06 07:01:33 -05:00
Jason Hunter
3a171d19e3 update contributing docs 2021-05-04 17:29:23 -05:00
Jason Hunter
480970c799 remove mqtt-cli 2021-05-04 17:29:23 -05:00
Jason Hunter
ceb3329f9e add rtmp port 2021-05-04 17:29:23 -05:00
Jason Hunter
1c0162c181 fix devcontainer setup 2021-05-04 17:29:23 -05:00
Blake Blackshear
0f1bc40f00 docs for core development 2021-02-25 07:01:59 -06:00
Blake Blackshear
4252857e19 remove tmpfs_cache_size option 2021-02-25 07:01:59 -06:00
Blake Blackshear
6d12a34c40 remove thumbnail attribute if null 2021-02-25 07:01:59 -06:00
Blake Blackshear
9e126a4b91 style cleanup 2021-02-25 07:01:59 -06:00
Blake Blackshear
040ffda687 use fstr log style 2021-02-25 07:01:59 -06:00
Blake Blackshear
39ff49e054 formatting cleanup 2021-02-25 07:01:57 -06:00
Blake Blackshear
b8f72a5bcb add devcontainer setup 2021-02-25 07:00:59 -06:00
Blake Blackshear
43db704b74 Update version 2021-02-25 07:00:57 -06:00
Paul Armstrong
5043040530 fix(web): ensure tooltips and menus don't cause scrollbar reflow 2021-02-25 06:34:36 -06:00
Paul Armstrong
3c60aeeef9 fix(web): set events api limit to 25 2021-02-25 06:34:36 -06:00
Blake Blackshear
0344d61b26 use gevent sleep to prevent mjpeg from blocking 2021-02-25 06:34:36 -06:00
Blake Blackshear
0e8467782b version tick 2021-02-25 06:34:36 -06:00
Paul Armstrong
423ea26266 Add paularmstrong to funding.yml 2021-02-24 20:58:44 -06:00
Paul Armstrong
2f3339ba85 docs: add contributing docs 2021-02-23 07:37:19 -06:00
Blake Blackshear
9433b50785 add stalebot 2021-02-22 07:20:39 -06:00
Blake Blackshear
1e7b53dc0e clarify h264 in docs 2021-02-22 07:20:32 -06:00
Blake Blackshear
bc94748f2a clips not playable 2021-02-22 07:10:56 -06:00
Blake Blackshear
2395f93ed1
Update bug_report.md 2021-02-22 06:43:21 -06:00
Blake Blackshear
d771726c2a version tick 2021-02-21 09:32:45 -06:00
Blake Blackshear
b2a2fe898c ensure base url works for websockets 2021-02-21 09:32:45 -06:00
Blake Blackshear
31d408a746 dynamic ws/wss selection 2021-02-20 08:20:17 -06:00
Blake Blackshear
4a74f295e7 docs updates 2021-02-20 08:20:17 -06:00
Paul Armstrong
b6ba6459fb feat(web): detect, clips, snapshots toggles 2021-02-20 08:20:17 -06:00
Paul Armstrong
e399790442 feat(web): mqtt for stats 2021-02-20 08:20:17 -06:00
Blake Blackshear
20c65b9a31 fix link and clarify audio encoding (fixes #800) 2021-02-20 08:20:17 -06:00
Blake Blackshear
1a7853a47e subscribe in the connect callback (fixes #814) 2021-02-20 08:20:17 -06:00
Blake Blackshear
683c3a4c90 update wheels again 2021-02-20 08:20:17 -06:00
Blake Blackshear
4a8d998afe unpin numpy 2021-02-20 08:20:17 -06:00
Paul Armstrong
fe59d90c51 web(test): routes/Events 2021-02-20 08:20:17 -06:00
Paul Armstrong
f87813805a test(web): RelativeModal 2021-02-20 08:20:17 -06:00
Paul Armstrong
a7e5b9978f test(web): Select 2021-02-20 08:20:17 -06:00