Added a significant overhaul to the server manager.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
import subprocess
|
||||
import logging
|
||||
import shutil
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Configure logging early
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.StreamHandler() # Log to console
|
||||
]
|
||||
)
|
||||
|
||||
def check_gpu_support():
|
||||
try:
|
||||
logger.debug("Checking ffmpeg for CUDA support...")
|
||||
result = subprocess.run("ffmpeg -hwaccels", shell=True, capture_output=True, text=True, check=True)
|
||||
if "cuda" in result.stdout:
|
||||
logger.info("ffmpeg with CUDA support detected. Enabling GPU acceleration.")
|
||||
return True
|
||||
except (FileNotFoundError, subprocess.CalledProcessError) as e:
|
||||
logger.debug(f"GPU detection failed: {e}")
|
||||
pass
|
||||
|
||||
logger.info("No ffmpeg with CUDA support detected. Falling back to CPU-based processing.")
|
||||
return False
|
||||
|
||||
class Settings(BaseSettings):
|
||||
samba_server_ip: str
|
||||
samba_username: str
|
||||
samba_password: str
|
||||
gpu_enabled: bool = check_gpu_support()
|
||||
|
||||
model_config = SettingsConfigDict(env_file=".env")
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user