> Representation of the control and database on the client via
> Javascript.
> Communication of the website via Ajax to a php-file on the server.
> Communication with the LMS via the php-file, e.g. json/rpc interface.
>
> For the first two points I will find the solution on the internet and it
> is not really correlated with the LMS-problematic. But could you please
> send me a link/tutorial/something to read, for the last point, how the
> json/rpc interface works.
First find some sample code for PHP doing JSON/RPC on the server side.
Eg. http://jsonrpcphp.org. Familiarize yourself with this method.
Then get familiar with LMS' implementation. It's easiest to eg. fire up
firebug in firefox and monitor what is going on when you browse the LMS
web UI. In the console you'd see all the requests going back and forth.
Documentation of the commands and queries available you'll find in
http://pi:9000/html/docs/cli-api.html (or whatever your server)
--
Michael
Results 11 to 20 of 21
-
2014-03-20, 23:47 #11
Problems with controlling my squeezeboces via myhomepage?!
-
2014-03-21, 03:20 #12
- Join Date
- Mar 2014
- Posts
- 16
Now everything is a bit clearer.
Will have a look into this. thx
-
2014-03-23, 04:34 #13
- Join Date
- Mar 2014
- Posts
- 16
Plugin SqueezeCloud usable with CLI/JSON-RPC
Hi,
something I come across while studying the CLI/JSON-RPC stuff was the controlling of the plugins, to be exact the SqueezeCloud-plugin.
Using the http-request method, the plugin can be controlled like this:
Code:anyurl?p0=playlist&p1=add&p2=soundcloud%3A%2F%2F106399621&p3=Falscher Hase at Fuchsbau Festival - 16-08-2013&player=MAC-adress
-
2014-03-24, 01:13 #14
Problems with controlling my squeezeboces via myhomepage?!
> --------------------
> anyurl?p0=playlist&p1=add&p2=soundcloud%3A%2F%2F10 6399621&p3=Falscher Hase at Fuchsbau Festival - 16-08-2013&player=MAC-adress
> --------------------
This would become something like
["00:02:40:....", ["playlist", "add", "soundloud:....", "Falscher hase..."]]
Check http://yourserver:9000/html/docs/cli...playlist%20add for
the command reference. It's pretty much putting p0-p99 into a list of
the json object.
--
Michael
-
2014-03-31, 04:03 #15
- Join Date
- Mar 2014
- Posts
- 16
Hi,
I found another (better?) solution. I just used the curl-function of php to control the LMS. Looks like this now:
Code:$JsonString = '$Json = json_encode(array("id" => 1, "method"=> "slim.request","params"=> array('; switch ($_POST["p0"]) { case 'pause' : case 'play' : $JsonString .= $playerId.',array("pause"))));'; break; case 'rewind': $JsonString .= $playerId.',array("time","-10"))));'; break; ... } eval($JsonString); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $LmsUrl); curl_setopt($ch, CURLOPT_USERPWD, $User.":".$Pw); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $Json); // $output contains the output string // $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); echo $output;
Code:$( ".LmsButton" ).click(function() { var blub = $(this).attr('id'); $.ajax({ url: '/JsonRpc.inc.php', type: 'POST', dataType: 'json', data: {p0: blub}, success: function(data) { } }) });
But I have another question, which came into my mind. Is it possible to send more than one command to the LMS, like
["00:02:40:....", ["playlist", "add", "soundloud:....", "Falscher hase..."],["playlist", "add", "soundloud:....", "Guter Esel..."],["play"]];
-
2014-03-31, 05:14 #16
Yes, but you need to send complete commands, including the target player. Just add them to the array.
---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
at penguinlovesmusic.com
New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch
-
2014-03-31, 08:46 #17
- Join Date
- Mar 2014
- Posts
- 16
Hi Pippin,
I think I don't get it.
What I tried
Code:{"id":1,"method":"slim.request","params":[<playerid>,["mode","?"],<playerid>,["artist","?"],<playerid>",["title","?"]]}
Code:{"params":["00:04:20:1e:e1:11",["mode","?"],"00:04:20:1e:e1:11",["artist","?"],"00:04:20:1e:e1:11",["title","?"]],"method":"slim.request","id":1,"result":{"_mode":"pause"}}
Could you please post an example. Thx in advance.
-
2014-03-31, 09:16 #18
Yes, you need to send an array of complete JSON/RPC commands:
Code:[ { "id":1, "method":"slim.request", "params":[<playerid>,["mode","?"]] }, { "id:2, "method":"slim.request", "params":[<playerid>,["artist","?"]] },... ]
---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
at penguinlovesmusic.com
New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch
-
2021-12-01, 11:54 #19
- Join Date
- Nov 2014
- Posts
- 18
-
2021-12-01, 12:26 #20
- Join Date
- Jun 2017
- Posts
- 707
Try this thread:
https://forums.slimdevices.com/showt...=1#post1036643Usually running latest beta LMS nightly on Raspberry Pi OS with virtual players (Squeezelite and Airplay bridge). Occasionally using SB Radio, Boom or Classic.