"""Optional FFmpeg capability detection.

Media is never written to disk in direct-stream mode, so FFmpeg is not used
for probing or thumbnail generation. The capability is retained for admin
diagnostics and future optional integrations.
"""

from __future__ import annotations

import logging
import shutil

logger = logging.getLogger(__name__)


class MediaProcessor:
    def __init__(self, *, enabled: bool = True) -> None:
        self.enabled = enabled
        self.ffmpeg = shutil.which("ffmpeg") if enabled else None
        self.ffprobe = shutil.which("ffprobe") if enabled else None
        if enabled and (not self.ffmpeg or not self.ffprobe):
            logger.warning(
                "FFmpeg/ffprobe not found; optional media diagnostics are unavailable"
            )

    @property
    def available(self) -> bool:
        return bool(self.enabled and self.ffmpeg and self.ffprobe)
