Refactor main.py and fix .env saving bug#3
Open
google-labs-jules[bot] wants to merge 7 commits intomainfrom
Open
Refactor main.py and fix .env saving bug#3google-labs-jules[bot] wants to merge 7 commits intomainfrom
google-labs-jules[bot] wants to merge 7 commits intomainfrom
Conversation
- Refactored `main.py` into a class-based structure to improve readability, maintainability, and organization. The monolithic while loop has been broken down into smaller, more manageable methods. - Encapsulated the application state within the `SecurityCamera` class to eliminate the use of numerous global-like variables. - Standardized all path construction to use `os.path.join()` for better cross-platform compatibility. - Fixed a bug in the `/api/save_env` endpoint in `run.py` where it was writing to `bob.txt` instead of the correct `.env` file.
…anges: - I implemented a threaded frame-reading mechanism to decouple camera I/O from the main processing loop. A dedicated thread now reads frames into a queue, preventing the main loop from blocking and allowing for a higher camera FPS. - I optimized the detection logic to reduce computational load. Expensive face and body detection algorithms are now run only every N frames, controlled by a `detection_interval` setting in `config.json`. - I added resizing of frames before running detection to further improve performance. - The last known detection results are used for frames where detection is skipped, ensuring a smooth visual experience.
- Adds a new 'Web Interface' section to the `README.md`. - Describes the features of the Dashboard, Settings, and User Management pages. - Includes placeholders for screenshots to be added later.
- Adds a new 'Web Interface' section to the `README.md`. - Describes the features of the Dashboard, Settings, and User Management pages. - Includes placeholders for screenshots to be added later.
- Adds Flask-SQLAlchemy for database management. - Adds Flask-Login for handling user sessions. - Adds Flask-Limiter for rate limiting login attempts. - Adds Werkzeug for password hashing.
- Adds a complete authentication system with a database, password hashing, and a login screen. - Implements a new admin panel for user management, including creating, editing, and deleting users. - Integrates the new user management system with the existing face recognition functionality. - Secures all pages and API endpoints with login and admin-only protection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change refactors the main application logic for better readability and maintainability and fixes a bug in the web interface related to saving environment variables.