* Reduce database queries to necessary labels
* Set columns for other queries
* skip creating model instances
---------
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
* Store camera labels in dict and other optimizations
* Add max on timeout so it is at least 60
* Ensure db timeout is at least 60
* Update list once a day to ensure new labels are cleaned up
* Formatting
* Insert recordings as bulk instead of individually.
* Fix
* Refactor event and timeline cleanup
* Remove unused
* Update pull_request.yml
* Add temporary table for deletion and use pagination to process recordings in chunks for deletion of recordings with missing files
* move RecordingsToDelete class to models.py
* recording cleanup: bugfixes
* Update cleanup.py
* improve log message in cleanup.py
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
---------
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* Enable auto vacuums
* Enable auto vacuum
* Fix separator
* Fix separator and remove incorrect log
* Limit to 1 row since that is all that is used
* Add index on camera + segment_size
* Formatting
* Increase timeout and cache_size
* Set DB mode to NORMAL synchronous level
* Formatting
* Vacuum every 2 weeks
* Remove fstring
* Use string
* Use consts
* Add isort and ruff linter
Both linters are pretty common among modern python code bases.
The isort tool provides stable sorting and grouping, as well as pruning
of unused imports.
Ruff is a modern linter, that is very fast due to being written in rust.
It can detect many common issues in a python codebase.
Removes the pylint dev requirement, since ruff replaces it.
* treewide: fix issues detected by ruff
* treewide: fix bare except clauses
* .devcontainer: Set up isort
* treewide: optimize imports
* treewide: apply black
* treewide: make regex patterns raw strings
This is necessary for escape sequences to be properly recognized.
* avoid executing external tools by using Python's built-in os module to interact with the filesystem directly
* Refactor recording cleanup script to use os module instead of subprocess
* black format util.py
* Ooooops
* Refactor get_cpu_stats() to properly identify recording process
* Move recordings management to own process and ensure db multiprocess access
* remove reference to old threads
* Cleanup directory remover
* Mypy fixes
* Fix mypy
* Add support back for setting record via MQTT and WS
* Formatting
* Fix rebase issue