Add runtime script management with Home Assistant integration
Features: - Runtime script CRUD operations (create, update, delete) - Thread-safe ConfigManager for YAML updates - WebSocket notifications for script changes - Web UI script management interface with full CRUD - Home Assistant auto-reload on script changes - Client-side position interpolation for smooth playback - Include command field in script list API response Technical improvements: - Added broadcast_scripts_changed() to WebSocket manager - Enhanced HA integration to handle scripts_changed messages - Implemented smooth position updates in Web UI (100ms interval) - Thread-safe configuration updates with file locking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
28
media_server/routes/audio.py
Normal file
28
media_server/routes/audio.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Audio device API endpoints."""
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from ..auth import verify_token
|
||||
from ..services import get_audio_devices
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(prefix="/api/audio", tags=["audio"])
|
||||
|
||||
|
||||
@router.get("/devices")
|
||||
async def list_audio_devices(_: str = Depends(verify_token)) -> list[dict[str, str]]:
|
||||
"""List available audio output devices.
|
||||
|
||||
Returns a list of audio devices with their IDs and friendly names.
|
||||
Use the device name in the `audio_device` config option to control
|
||||
a specific device instead of the default one.
|
||||
|
||||
Returns:
|
||||
List of audio devices with id and name
|
||||
"""
|
||||
devices = get_audio_devices()
|
||||
logger.debug("Found %d audio devices", len(devices))
|
||||
return devices
|
||||
Reference in New Issue
Block a user