Component-based architecture with lifecycle management
Enhanced error handling and recovery mechanisms
Comprehensive state management and tracking
Event-driven architecture with monitoring
Queue Management:
Multiple processing strategies for different scenarios
Advanced state management with recovery
Comprehensive metrics and health monitoring
Sophisticated cleanup system with multiple strategies
Processing Pipeline:
Enhanced message handling with validation
Improved URL extraction and processing
Better queue management and monitoring
Advanced cleanup mechanisms
Overall Benefits:
Better code organization and maintainability
Improved error handling and recovery
Enhanced monitoring and reporting
More robust and reliable system
Added proper cancellation and requeuing of downloads in VideoProcessor
Added cancellable logger and process cleanup in VideoDownloader
Added shutdown flag and force_stop capability in EnhancedQueueManager
Added process tracking and kill_all_processes method in FFmpegManager
The changes ensure that:
Active downloads are paused and requeued when unload is called
If cleanup takes too long, force cleanup kicks in
All resources are properly cleaned up, even in case of timeout
Downloads can be safely cancelled and resumed later
No processes are left hanging during unload
Added missing discord import
Added proper error handling for all discord operations
Improved error reporting for discord-specific failures
Enhanced Error Handling:
Added try/except blocks around all major operations
Implemented proper cleanup in finally blocks
Added more specific error messages for debugging
Queue Processing Improvements:
Ensured the queue continues processing even if individual items fail
Added better file cleanup to prevent resource leaks
Improved error reporting to help diagnose issues
Resource Management:
Added proper cleanup of downloaded files
Improved handling of missing discord resources
Better management of failed downloads
Separated physical GPU detection from FFmpeg encoder support
Only enable GPU encoding when both physical GPU and FFmpeg support exist
Added multiple detection methods for better reliability
Moved FFmpeg manager to cog level instead of per-guild
Created single shared FFmpeg manager instance in VideoArchiver class
Passed shared FFmpeg manager to VideoProcessor and VideoDownloader
Removed redundant FFmpeg downloads for each guild
Component Management:
Updated VideoArchiver to initialize one FFmpeg manager
Modified guild components to remove FFmpeg manager
Updated component cleanup to handle shared resources
Improved resource initialization order
Resource Efficiency:
Eliminated duplicate FFmpeg binary downloads
Reduced disk space usage
Improved initialization time
Better resource sharing across guilds
Error Handling:
Added proper cleanup for shared resources
Improved error propagation
Enhanced initialization error handling
Better component lifecycle management
Added minimum video bitrate (500 Kbps) to prevent quality degradation
Fixed audio bitrate calculation with proper min/max per channel
Added standard audio sample rate (48 kHz)
Improved bitrate allocation between video and audio
Added URL pre-filtering to avoid unnecessary yt-dlp checks
Added common video platform patterns for quick filtering
Reduced error logging noise from non-URL words
Improved URL validation efficiency
FFmpeg Management:
Enhanced FFmpeg binary verification
Added robust error handling for subprocess calls
Improved cleanup of failed operations
Added detailed logging for binary operations
Error Handling:
Fixed exception hierarchy in utils/exceptions.py
Added proper error types for different failure scenarios
Enhanced error messages with more context
Improved error propagation through the system
Process Flow:
Added proper timeout handling for subprocess calls
Enhanced environment variable handling
Better cleanup after failures
Added retry mechanisms for failed operations
Updated extraction logic to handle BtbN's new archive structure with binaries in the bin directory
Added fallback to old structure for backward compatibility
Improved binary verification and permissions handling
Enhanced error handling during extraction and verification
Error Handling:
Added specific exception types for different errors
Better error propagation through the system
Improved error logging and user feedback
Enhanced cleanup on errors
Resource Management:
Better cleanup of failed downloads
Proper handling of temporary files
Enhanced queue management
Improved file deletion with retries
Verification:
FFmpeg binary verification with version checks
Video file integrity verification
Compression result verification
Archive structure verification
The system now:
Properly handles FFmpeg's new archive structure
Better manages binary downloads and verification
Provides more detailed error messages
Cleans up resources properly
Shows appropriate reactions for different error types
FFmpeg is now properly managed:
Binaries are downloaded and verified on startup
Permissions are properly set
Hardware acceleration is detected and used when available
Resources are cleaned up properly
Error handling has been improved:
Specific exception types for different errors
Better error messages and logging
Appropriate reaction indicators
Enhanced component error handling
Resource management has been enhanced:
Failed downloads are tracked and cleaned up
Temporary files are handled properly
Queue management is more robust
Concurrent downloads are better managed
Verification has been strengthened:
FFmpeg binaries are verified
Video files are validated
Compression results are checked
Component initialization is verified
- Enhanced Docker compatibility with proper permissions
- Better error handling and logging
- Improved download and extraction process
- Added detailed type hints and documentation