FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix/stream control params by Chreece · Pull Request #85 · happyleavesaoc/python-snapcast · GitHub

Repository navigation

Fix/stream control params - #85

Open
Chreece wants to merge 2 commits into
happyleavesaoc:masterfrom
Chreece:fix/stream-control-params
Open

Chreece wants to merge 2 commits into
happyleavesaoc:masterfrom
Chreece:fix/stream-control-params

Conversation

Chreece commented Oct 2, 2026

Copy link
Copy Markdown

Summary

Fix Snapserver.stream_control() so command-specific parameters are sent in the nested params object expected by Snapserver's Stream.Control JSON-RPC API.

The current implementation passes control_params into _request() as a generic parameters mapping, which causes values such as position or offset to be flattened into the top-level request parameters.

This means parameterless commands such as play, pause, playPause, stop, next, and previous can work, while parameterized commands such as seek and setPosition are sent with an invalid payload.

Current behavior

A call such as:

await server.stream_control(
    "stream",
    "setPosition",
    {"position": 12.5},
)

currently produces the equivalent of:

{
  "id": "stream",
  "command": "setPosition",
  "position": 12.5
}

Snapserver expects:

{
  "id": "stream",
  "command": "setPosition",
  "params": {
    "position": 12.5
  }
}

Changes

This PR sends control arguments under the required nested params key, makes control_params optional, defaults parameterless commands to "params": {}, preserves the existing parameterless transport controls, and enables correctly formatted seek and setPosition requests.

Tests

Adds regression tests for the exact JSON-RPC payload generated for:

  • a parameterless pause command
  • a parameterized setPosition command

The tests verify that Stream.Control requests match the format expected by Snapserver.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL