URL Processing:

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
This commit is contained in:
pacnpal
2024-11-15 04:51:17 +00:00
parent 9dc3ef247c
commit 7e9e193178
4 changed files with 102 additions and 39 deletions

View File

@@ -16,7 +16,9 @@ class DownloadError(FFmpegError):
class VerificationError(FFmpegError):
"""Exception raised when FFmpeg verification fails"""
pass
def __init__(self, message: str, binary_type: str = "FFmpeg"):
self.binary_type = binary_type
super().__init__(f"{binary_type} verification failed: {message}")
class EncodingError(FFmpegError):
@@ -142,5 +144,9 @@ def handle_ffmpeg_error(error_output: str) -> FFmpegError:
return BitrateError("Bitrate requirements not met", 0, 0)
elif "timeout" in error_output:
return TimeoutError("Operation timed out")
elif "version" in error_output:
return VerificationError("Version check failed")
elif "verification" in error_output:
return VerificationError(error_output)
else:
return FFmpegError(f"FFmpeg operation failed: {error_output}")