feat: Add mute and unmute functionality to player service and API
Some checks failed
Backend CI / lint (push) Failing after 4m52s
Backend CI / test (push) Failing after 3m44s

This commit is contained in:
JSC
2025-08-10 15:11:28 +02:00
parent 0a8b50a0be
commit 8544a3ce22
3 changed files with 52 additions and 0 deletions

View File

@@ -165,6 +165,40 @@ async def set_volume(
) from e
@router.post("/mute")
async def mute(
current_user: Annotated[User, Depends(get_current_active_user_flexible)], # noqa: ARG001
) -> MessageResponse:
"""Mute playback."""
try:
player = get_player_service()
await player.mute()
return MessageResponse(message="Playback muted")
except Exception as e:
logger.exception("Error muting playback")
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Failed to mute playback",
) from e
@router.post("/unmute")
async def unmute(
current_user: Annotated[User, Depends(get_current_active_user_flexible)], # noqa: ARG001
) -> MessageResponse:
"""Unmute playback."""
try:
player = get_player_service()
await player.unmute()
return MessageResponse(message="Playback unmuted")
except Exception as e:
logger.exception("Error unmuting playback")
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Failed to unmute playback",
) from e
@router.post("/mode")
async def set_mode(
request: PlayerModeRequest,