- Adjusted function signatures in various test files to enhance clarity by aligning parameters. - Updated patching syntax for better readability across test cases. - Improved formatting and spacing in test assertions and mock setups. - Ensured consistent use of async/await patterns in async test functions. - Enhanced comments for better understanding of test intentions.
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""Player schemas."""
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from app.services.player import PlayerMode
|
|
|
|
|
|
class PlayerSeekRequest(BaseModel):
|
|
"""Request model for seek operation."""
|
|
|
|
position: int = Field(ge=0, description="Position in milliseconds")
|
|
|
|
|
|
class PlayerVolumeRequest(BaseModel):
|
|
"""Request model for volume control."""
|
|
|
|
volume: int = Field(ge=0, le=100, description="Volume level (0-100)")
|
|
|
|
|
|
class PlayerModeRequest(BaseModel):
|
|
"""Request model for mode change."""
|
|
|
|
mode: PlayerMode = Field(description="Playback mode")
|
|
|
|
|
|
class PlayerStateResponse(BaseModel):
|
|
"""Response model for player state."""
|
|
|
|
status: str = Field(description="Player status (playing, paused, stopped)")
|
|
current_sound: dict[str, Any] | None = Field(
|
|
None,
|
|
description="Current sound information",
|
|
)
|
|
playlist: dict[str, Any] | None = Field(
|
|
None,
|
|
description="Current playlist information",
|
|
)
|
|
position: int = Field(description="Current position in milliseconds")
|
|
duration: int | None = Field(
|
|
None,
|
|
description="Total duration in milliseconds",
|
|
)
|
|
volume: int = Field(description="Current volume (0-100)")
|
|
mode: str = Field(description="Current playback mode")
|
|
index: int | None = Field(
|
|
None,
|
|
description="Current track index in playlist",
|
|
)
|