mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
fix(ffmpeg): add fallback to absolute imports in __init__.py
This commit is contained in:
@@ -18,30 +18,59 @@ logging.basicConfig(
|
|||||||
logger = logging.getLogger("VideoArchiver")
|
logger = logging.getLogger("VideoArchiver")
|
||||||
|
|
||||||
# Import components after logging is configured
|
# Import components after logging is configured
|
||||||
from .ffmpeg_manager import FFmpegManager
|
try:
|
||||||
from .video_analyzer import VideoAnalyzer
|
# Try relative imports first
|
||||||
from .gpu_detector import GPUDetector
|
from .ffmpeg_manager import FFmpegManager
|
||||||
from .encoder_params import EncoderParams
|
from .video_analyzer import VideoAnalyzer
|
||||||
from .ffmpeg_downloader import FFmpegDownloader
|
from .gpu_detector import GPUDetector
|
||||||
from .exceptions import (
|
from .encoder_params import EncoderParams
|
||||||
FFmpegError,
|
from .ffmpeg_downloader import FFmpegDownloader
|
||||||
DownloadError,
|
from .exceptions import (
|
||||||
VerificationError,
|
FFmpegError,
|
||||||
EncodingError,
|
DownloadError,
|
||||||
AnalysisError,
|
VerificationError,
|
||||||
GPUError,
|
EncodingError,
|
||||||
HardwareAccelerationError,
|
AnalysisError,
|
||||||
FFmpegNotFoundError,
|
GPUError,
|
||||||
FFprobeError,
|
HardwareAccelerationError,
|
||||||
CompressionError,
|
FFmpegNotFoundError,
|
||||||
FormatError,
|
FFprobeError,
|
||||||
PermissionError,
|
CompressionError,
|
||||||
TimeoutError,
|
FormatError,
|
||||||
ResourceError,
|
PermissionError,
|
||||||
QualityError,
|
TimeoutError,
|
||||||
AudioError,
|
ResourceError,
|
||||||
BitrateError,
|
QualityError,
|
||||||
)
|
AudioError,
|
||||||
|
BitrateError,
|
||||||
|
)
|
||||||
|
except ImportError:
|
||||||
|
# Fall back to absolute imports if relative imports fail
|
||||||
|
from videoarchiver.ffmpeg.ffmpeg_manager import FFmpegManager
|
||||||
|
from videoarchiver.ffmpeg.video_analyzer import VideoAnalyzer
|
||||||
|
from videoarchiver.ffmpeg.gpu_detector import GPUDetector
|
||||||
|
from videoarchiver.ffmpeg.encoder_params import EncoderParams
|
||||||
|
from videoarchiver.ffmpeg.ffmpeg_downloader import FFmpegDownloader
|
||||||
|
from videoarchiver.ffmpeg.exceptions import (
|
||||||
|
FFmpegError,
|
||||||
|
DownloadError,
|
||||||
|
VerificationError,
|
||||||
|
EncodingError,
|
||||||
|
AnalysisError,
|
||||||
|
GPUError,
|
||||||
|
HardwareAccelerationError,
|
||||||
|
FFmpegNotFoundError,
|
||||||
|
FFprobeError,
|
||||||
|
CompressionError,
|
||||||
|
FormatError,
|
||||||
|
PermissionError,
|
||||||
|
TimeoutError,
|
||||||
|
ResourceError,
|
||||||
|
QualityError,
|
||||||
|
AudioError,
|
||||||
|
BitrateError,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FFmpeg:
|
class FFmpeg:
|
||||||
"""Main FFmpeg interface"""
|
"""Main FFmpeg interface"""
|
||||||
@@ -150,6 +179,7 @@ class FFmpeg:
|
|||||||
logger.error(f"Failed to get FFmpeg version: {e}")
|
logger.error(f"Failed to get FFmpeg version: {e}")
|
||||||
raise FFmpegError(f"Failed to get FFmpeg version: {e}")
|
raise FFmpegError(f"Failed to get FFmpeg version: {e}")
|
||||||
|
|
||||||
|
|
||||||
# Initialize default instance
|
# Initialize default instance
|
||||||
try:
|
try:
|
||||||
ffmpeg = FFmpeg()
|
ffmpeg = FFmpeg()
|
||||||
@@ -158,6 +188,7 @@ except Exception as e:
|
|||||||
logger.error(f"Failed to initialize default FFmpeg instance: {e}")
|
logger.error(f"Failed to initialize default FFmpeg instance: {e}")
|
||||||
ffmpeg = None
|
ffmpeg = None
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'FFmpeg',
|
'FFmpeg',
|
||||||
'ffmpeg',
|
'ffmpeg',
|
||||||
|
|||||||
Reference in New Issue
Block a user