Refactor project into two standalone components
Split monorepo into separate units for future independent repositories: - media-server/: Standalone FastAPI server with own README, requirements, config example, and CLAUDE.md - haos-integration/: HACS-ready Home Assistant integration with hacs.json, own README, and CLAUDE.md Both components now have their own .gitignore files and can be easily extracted into separate repositories. Also adds custom icon support for scripts configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
17
media-server/media_server/models/__init__.py
Normal file
17
media-server/media_server/models/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""Pydantic models for the media server API."""
|
||||
|
||||
from .media import (
|
||||
MediaState,
|
||||
MediaStatus,
|
||||
VolumeRequest,
|
||||
SeekRequest,
|
||||
MediaInfo,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"MediaState",
|
||||
"MediaStatus",
|
||||
"VolumeRequest",
|
||||
"SeekRequest",
|
||||
"MediaInfo",
|
||||
]
|
||||
61
media-server/media_server/models/media.py
Normal file
61
media-server/media_server/models/media.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""Media-related Pydantic models."""
|
||||
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class MediaState(str, Enum):
|
||||
"""Playback state enumeration."""
|
||||
|
||||
PLAYING = "playing"
|
||||
PAUSED = "paused"
|
||||
STOPPED = "stopped"
|
||||
IDLE = "idle"
|
||||
|
||||
|
||||
class MediaInfo(BaseModel):
|
||||
"""Information about the currently playing media."""
|
||||
|
||||
title: Optional[str] = Field(None, description="Track/media title")
|
||||
artist: Optional[str] = Field(None, description="Artist name")
|
||||
album: Optional[str] = Field(None, description="Album name")
|
||||
album_art_url: Optional[str] = Field(None, description="URL to album artwork")
|
||||
duration: Optional[float] = Field(
|
||||
None, description="Total duration in seconds", ge=0
|
||||
)
|
||||
position: Optional[float] = Field(
|
||||
None, description="Current position in seconds", ge=0
|
||||
)
|
||||
|
||||
|
||||
class MediaStatus(BaseModel):
|
||||
"""Complete media playback status."""
|
||||
|
||||
state: MediaState = Field(default=MediaState.IDLE, description="Playback state")
|
||||
title: Optional[str] = Field(None, description="Track/media title")
|
||||
artist: Optional[str] = Field(None, description="Artist name")
|
||||
album: Optional[str] = Field(None, description="Album name")
|
||||
album_art_url: Optional[str] = Field(None, description="URL to album artwork")
|
||||
duration: Optional[float] = Field(
|
||||
None, description="Total duration in seconds", ge=0
|
||||
)
|
||||
position: Optional[float] = Field(
|
||||
None, description="Current position in seconds", ge=0
|
||||
)
|
||||
volume: int = Field(default=100, description="Volume level (0-100)", ge=0, le=100)
|
||||
muted: bool = Field(default=False, description="Whether audio is muted")
|
||||
source: Optional[str] = Field(None, description="Media source/player name")
|
||||
|
||||
|
||||
class VolumeRequest(BaseModel):
|
||||
"""Request model for setting volume."""
|
||||
|
||||
volume: int = Field(..., description="Volume level (0-100)", ge=0, le=100)
|
||||
|
||||
|
||||
class SeekRequest(BaseModel):
|
||||
"""Request model for seeking to a position."""
|
||||
|
||||
position: float = Field(..., description="Position in seconds to seek to", ge=0)
|
||||
Reference in New Issue
Block a user