52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
"""
|
|
System endpoints - health checks and FFmpeg capabilities.
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from core.ffmpeg import get_decoders, get_encoders, get_formats
|
|
|
|
router = APIRouter(prefix="/system", tags=["system"])
|
|
|
|
|
|
@router.get("/health")
|
|
def health_check():
|
|
"""Health check endpoint."""
|
|
return {"status": "healthy"}
|
|
|
|
|
|
@router.get("/status")
|
|
def system_status():
|
|
"""System status for UI."""
|
|
return {"status": "ok", "version": "0.1.0"}
|
|
|
|
|
|
@router.get("/worker")
|
|
def worker_status():
|
|
"""Worker status from gRPC."""
|
|
try:
|
|
from mpr.grpc.client import get_client
|
|
|
|
client = get_client()
|
|
status = client.get_worker_status()
|
|
if status:
|
|
return status
|
|
return {"available": False, "error": "No response from worker"}
|
|
except Exception as e:
|
|
return {"available": False, "error": str(e)}
|
|
|
|
|
|
@router.get("/ffmpeg/codecs")
|
|
def ffmpeg_codecs():
|
|
"""Get available FFmpeg encoders and decoders."""
|
|
return {
|
|
"encoders": get_encoders(),
|
|
"decoders": get_decoders(),
|
|
}
|
|
|
|
|
|
@router.get("/ffmpeg/formats")
|
|
def ffmpeg_formats():
|
|
"""Get available FFmpeg muxers and demuxers."""
|
|
return get_formats()
|