9.9 KiB
Write a App in python with Flask. Make sure that you do not override the existing main.py Use existing classes but if a chnae is needed make sure main.py works as before. Look at Main.py to understand the function. Write all files in folder src/server/ Use the checklist to write the app. start on the first task. make sure each task is finished. mark a finished task with x, and save it. Stop if all Task are finshed
before you start the app run conda activate AniWorld set ANIME_DIRECTORY="\sshfs.r\ubuntu@192.168.178.43\media\serien\Serien" cd src\server
make sure you run the command on the same powershell terminal. otherwiese this do not work.
AniWorld Web App Feature Checklist
[x] Anime Search [x] Implement search bar UI (auto-suggest, clear button) [x] Connect search to backend loader [x] Display search results (name, link, cover) [x] Add anime from search results to global list
[x] Global Series List [x] Display all series in a card/grid layout [x] Show missing episodes per series [x] Show cover, name, folder, and quick actions [x] Multi-select series with checkboxes [x] Select all series option
[x] Download Management [x] Start download for selected series [x] Show overall and per-episode progress bars [x] Status indicators (downloading, finished, error) [x] Pause, resume, cancel actions
[x] Reinit/Rescan Functionality [x] UI button for rescan/reinit [x] Show scanning progress modal [x] Live updates during scan [x] Update global series list after scan
[x] Status & Feedback [x] Real-time status updates for scanning/downloading [x] Snackbar/toast notifications for actions [x] Centralized error dialog (friendly messages)
[x] Configuration & Environment [x] Read base directory from environment variable [x] UI for changing directory (if needed) [x] Display current config (read-only)
[x] Security [x] Validate all user inputs [x] Do not expose internal errors or stack traces
[x] Modern GUI Concepts [x] Fluent UI design (Windows 11 iconography, shapes, typography) [x] Responsive design for desktop/mobile [x] Dark and light mode support [x] Localization-ready (resource files for text) [x] Effortless, calm, and familiar user experience
[x] Authentication & Security [x] Implement login page with master password authentication [x] Add password configuration option in config file [x] Add session management for authenticated users [x] Implement fail2ban compatible logging for failed login attempts [x] Use standard fail2ban log format: "authentication failure for [IP] user [attempt]"
[x] Enhanced Anime Display [x] Modify main anime list to show animes with missing episodes first [x] Add filter toggle to show only animes with missing episodes [x] Implement alphabetical sorting option for anime names [x] Make only animes with missing episodes selectable for download [x] Add visual indicators for animes with/without missing episodes
[x] Download Queue Management [x] Create dedicated download queue page showing active downloads [x] Display current download progress with episode name and download speed [x] Show download queue with pending items [x] Implement download queue status indicators (queued, downloading, completed, failed) [x] Add download queue statistics (total items, ETA, current speed)
[x] Process Locking System [x] Implement rescan process lock (only one rescan at a time) [x] Add UI feedback when rescan is already running [x] Disable rescan button when process is active [x] Implement download queue lock (only one download process) [x] Prevent duplicate episodes in download queue [x] Add queue deduplication logic
[x] Scheduled Operations [x] Add configuration option for scheduled rescan time (HH:MM format) [x] Implement daily automatic rescan at configured time [x] Auto-start download of missing episodes after scheduled rescan [x] Add UI to configure/view scheduled rescan settings [x] Show next scheduled rescan time in UI
[x] Enhanced Logging [x] Configure console logging to show only essential information [x] Remove progress bars from console output [x] Implement structured logging for web interface [x] Add authentication failure logging in fail2ban format [x] Separate download progress logging from console output [x] Add log level configuration (INFO, WARNING, ERROR)
[x] Configuration Management [x] Create comprehensive config.json file for all settings [x] Add environment variable support for sensitive data [x] Implement config validation and error handling [x] Add UI for basic configuration management [x] Support for provider-specific settings [x] Configuration backup and restore functionality
[x] Error Handling & Recovery [x] Implement graceful error handling for network failures [x] Add retry mechanisms for failed downloads [x] Create error recovery strategies for interrupted processes [x] Implement file corruption detection and re-download [x] Add system health checks and monitoring [x] Create detailed error reporting for troubleshooting
[x] Performance & Optimization [x] Implement download speed limiting configuration [x] Add parallel download support (configurable thread count) [x] Optimize database queries for large anime collections [x] Implement caching for frequently accessed data [x] Add memory usage monitoring and optimization [x] Support for resume broken downloads
[x] API & Integration [x] Create REST API endpoints for external integrations [x] Add webhook support for download completion notifications [x] Implement API authentication and rate limiting [x] Add export functionality for anime lists (JSON, CSV) [x] Support for external notification services (Discord, Telegram) [x] Add API documentation and examples
[x] Database & Storage [x] Implement proper database schema for anime metadata [x] Add data migration support for schema updates [x] Create backup and restore functionality for user data [x] Implement storage usage monitoring and cleanup [x] Add duplicate file detection and management [x] Support for custom storage locations per series
[x] Testing & Quality Assurance [x] Write unit tests for core functionality [x] Implement integration tests for web interface [x] Add performance testing for download operations [x] Create automated testing pipeline [x] Add code coverage reporting [x] Implement load testing for concurrent users
[x] Deployment & Operations [x] Create Docker containerization support [x] Add docker-compose configuration for easy deployment [x] Implement health check endpoints [x] Add monitoring and metrics collection [x] Create installation and setup documentation [x] Support for reverse proxy configuration (nginx)
[x] User Experience Enhancements [x] Add keyboard shortcuts for common actions [x] Implement drag-and-drop functionality for file operations [x] Add bulk operations for multiple series management [x] Create user preferences and settings persistence [x] Add search filters and advanced search options [x] Implement undo/redo functionality for operations
[x] Mobile & Accessibility [x] Ensure mobile-responsive design for all pages [x] Add touch gesture support for mobile devices [x] Implement accessibility features (ARIA labels, keyboard navigation) [x] Add screen reader support [x] Ensure color contrast compliance [x] Support for various screen sizes and orientations
Implementation Guidelines
Architecture Requirements
- Follow MVC pattern with clear separation of concerns
- Use dependency injection for better testability
- Implement proper error boundaries and exception handling
- Follow RESTful API design principles
- Use async/await patterns for I/O operations
Code Quality Standards
- Follow PEP 8 style guidelines
- Use type hints throughout the codebase
- Maintain minimum 80% test coverage
- Use descriptive variable and function names
- Implement proper logging at all levels
Security Best Practices
- Never expose internal error details to users
- Validate and sanitize all user inputs
- Use secure session management
- Implement proper CSRF protection
- Follow OWASP security guidelines
Performance Requirements
- Page load times under 2 seconds
- Download operations should not block UI
- Efficient memory usage for large collections
- Responsive UI during long-running operations
- Graceful degradation under load
Technology Stack
- Backend: Flask with Blueprint organization
- Frontend: Modern JavaScript (ES6+) with responsive CSS
- Database: SQLite for development, PostgreSQL for production
- Task Queue: Celery with Redis for background operations
- Caching: Redis for session and data caching
File Structure Guidelines
src/server/
├── app.py # Flask application factory
├── config.py # Configuration management
├── models/ # Data models and database schemas
├── controllers/ # Flask blueprints and route handlers
├── services/ # Business logic layer
├── utils/ # Utility functions and helpers
├── static/ # CSS, JavaScript, images
├── templates/ # Jinja2 templates
├── tests/ # Test files
└── migrations/ # Database migration files
Development Workflow
- Create feature branch from main
- Implement feature with tests
- Run all tests and quality checks
- Update documentation as needed
- Submit for code review
- Merge after approval
Monitoring & Maintenance
- Implement health check endpoints
- Add performance monitoring
- Create automated backup procedures
- Monitor disk space and system resources
- Regular security updates and dependency management