Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Forked from samtherussell/api_ref.txt
Created June 11, 2022 12:11
Show Gist options
  • Save raspberrypisig/6d64748d72aac31fb58f499e165ed864 to your computer and use it in GitHub Desktop.
Save raspberrypisig/6d64748d72aac31fb58f499e165ed864 to your computer and use it in GitHub Desktop.
Logitech SqueezeServer JSONRPC API
Squeezebox API
--------------
This document outlines the JSON RPC interface with a squeezeserver to control and obtain information about squeezeboxes.
JSON : JavaScript Object Notation
RPC : Remote Procedure Call
Uses POST requests sent to:
http://<squeezeserver_address>:9000/jsonrpc.js
With Content-Type header set to
application/json
And a JSON object in the body.
{'method': 'slim.request', 'params': [<player_mac_address>, <command>]}
where <player_mac_address> is the squeezebox's MAC address that you are controlling (or "-" to get server info).
and <command> is the command you want to send.
# Simple commands:
- PLAY: ["play"]
- PAUSE: ["pause"],
- POWER ON: ["power", "1"],
- POWER OFF: ["power", "0"],
- VOLUME UP: ["mixer","volume","+<i>"], # <i> is a base 10 number. (volume goes from 0-100)
- VOLUME DOWN: ["mixer","volume","-<i>"],
- SET VOLUME: ["mixer","volume","<i>"],
- SLEEP IN SECONDS: ["sleep","300"],
- SLEEP END OF SONG: ["jiveendoftracksleep"],
- SKIP: ["playlist","index","+1"],
- PREVIOUS: ["playlist","index","-1"],
- UNSYNC FROM ALL PLAYERS: ["sync","-"]
So to pause the squeezebox with mac address FF:FF:FF:FF you would send the JSON object:
{'method': 'slim.request', 'params': ["FF:FF:FF:FF", ["play"]]}
To get a player's status use the command:
STATUS: ["status","-"]
To SYNCHRONISE two players together:
'params': [<master>, ["sync",<slave>]]
where <master> and <slave> are the player MAC address strings.
The slave player will follow the master player.
To SWITCH PLAYER from one squeezebox to another.
'params': [<either>["switchplayer","from:" + <source>,"to:" + <destination>]]
where <source>, <destination> and <either> are the player MAC address strings.
The music will be sent from the source player to the destination player.
You can get the connected players with:
use get number of players first:
'params': ["FF:FF:FF:FF", ["player","count", "?"]]
Then using returned _count:
'params': ["FF:FF:FF:FF", ["players","0", <count>]]
You can search for music accroding to a search term by:
SEARCH: ["search", <i>, <j>, "term:" + <search_term>]
where <search_term> is the search term,
<i> is the beginning index, and <j> the finish index. ie. for the first 10 results: i=0, j=10.
Once you have obtained the "id" of the music you want to play, you can set it to play on a squeezebox:
- ["playlistcontrol", "cmd:"+<cmd>, "artist_id:"+<artist_id>]
- ["playlistcontrol", "cmd:"+<cmd>, "album_id:"+<album_id>]
- ["playlistcontrol", "cmd:"+<cmd>, "track_id:"+<track_id>]
where command is one of:
- PLAY NOW: "load"
- ADD TO END: "add"
- ADD NEXT: "insert"
@raspberrypisig
Copy link
Author

documentation on the lms server itself

http://localhost:9000/html/docs/cli-api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment