- Each task is now its own class
- Added a database to track backed up events and their destinations
- Added task to check for and backup missed events
e.g DISCONNECT events never have video associated with them, skip
processing if we encounter events of types we are not interested in.
Co-authored-by: Sebastian Goscik <sebastian.goscik@live.co.uk>
Unifi protect does not return full video clips if the clip is requested too soon.
There are two issues at play here:
- Protect will only cut a clip on an keyframe which happen every 5s
- Protect's pipeline needs a finite amount of time to make a clip available
Known Issues: It still seems to sometimes miss a single frame
Both network issues and restarts of Unifi Protect can cause the
websocket to disconnect. Once this happens, no more events are
recieved, and hence no events are stored via rclone.
We add a task which checks that the websocket is connected every
minute. If the websocket is not connected, the connection is totally
reset. For a simple network issue, is should be sufficient to just
call pyunifiprotect's update(), but this doesn't work when protect has
been restarted. Given that this is a tool that should always be
running, we opt for the most extreme option of totally resetting the
connection, and re-establishing it from scratch.
Today after adding a new camera for testing, it became
clear that the previous assumption that pyunifiprotect
would update its bootstrap when new cameras were
added was incorrect.
Add in the capability to pass extra arguments through to rclone. These
are passed verbatim, and are set to '' by default. They can be passed
either with --rclone-args or by setting the environment variable
RCLONE_ARGS.
For example. the expectation is that the end user can use these for
setting a bandwidth limit so that rclone uploading doesn't saturate
their internet bandwidth.
Previously it used RuntimeExceptions which could also be raised from other source.
This also meant some exceptions could be passed silently which is no longer the case
The rclone pruge method needed access to self but wasnt called in such a way that it had it.
Previously it would leave empty directories once files were purged. This is no longer the case
by chaining a call to `rclone rmdirs`