feat: Add play next functionality to player service and API
This commit is contained in:
@@ -249,3 +249,21 @@ async def get_state(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Failed to get player state",
|
||||
) from e
|
||||
|
||||
|
||||
@router.post("/play-next/{sound_id}")
|
||||
async def add_to_play_next(
|
||||
sound_id: int,
|
||||
current_user: Annotated[User, Depends(get_current_active_user_flexible)], # noqa: ARG001
|
||||
) -> MessageResponse:
|
||||
"""Add a sound to the play next queue."""
|
||||
try:
|
||||
player = get_player_service()
|
||||
await player.add_to_play_next(sound_id)
|
||||
return MessageResponse(message=f"Added sound {sound_id} to play next queue")
|
||||
except Exception as e:
|
||||
logger.exception("Error adding sound to play next queue: %s", sound_id)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Failed to add sound to play next queue",
|
||||
) from e
|
||||
|
||||
Reference in New Issue
Block a user