Initial commit: Media Server for remote media control

FastAPI REST API server for controlling system-wide media playback
on Windows, Linux, macOS, and Android.

Features:
- Play/Pause/Stop/Next/Previous track controls
- Volume control and mute
- Seek within tracks
- Current track info (title, artist, album, artwork)
- WebSocket real-time status updates
- Script execution API
- Token-based authentication
- Cross-platform support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 14:41:00 +03:00
commit 83acf5f1ec
26 changed files with 3562 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
"""Abstract base class for media controllers."""
from abc import ABC, abstractmethod
from ..models import MediaStatus
class MediaController(ABC):
"""Abstract base class for platform-specific media controllers."""
@abstractmethod
async def get_status(self) -> MediaStatus:
"""Get the current media playback status.
Returns:
MediaStatus with current playback info
"""
pass
@abstractmethod
async def play(self) -> bool:
"""Resume or start playback.
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def pause(self) -> bool:
"""Pause playback.
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def stop(self) -> bool:
"""Stop playback.
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def next_track(self) -> bool:
"""Skip to the next track.
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def previous_track(self) -> bool:
"""Go to the previous track.
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def set_volume(self, volume: int) -> bool:
"""Set the system volume.
Args:
volume: Volume level (0-100)
Returns:
True if successful, False otherwise
"""
pass
@abstractmethod
async def toggle_mute(self) -> bool:
"""Toggle the mute state.
Returns:
The new mute state (True = muted)
"""
pass
@abstractmethod
async def seek(self, position: float) -> bool:
"""Seek to a position in the current track.
Args:
position: Position in seconds
Returns:
True if successful, False otherwise
"""
pass