I would say it is unpublished, or not published enough. Basically, the idea is to use the CLI API over HTTP. To exchange data, the JSON data format is used. To transfer data between the server and the client, XMLHttpRequest (Ajax) is used. JSON data processing is easily written in Javascript within a browser, but also in many other languages.
I have posted a perl script here: http://forums.slimdevices.com/showthread.php?p=399998 (message 496 and following) The script is not a plugin, so it needs to (1) handle logging to SN and (2) get/set CLI commands in the JSON style. Hence in the code I used both Gisle Aas's LWP::UserAgent + HTTP::Cookies modules (for 1) and the JSON::RPC::Client module (for 2) I am using about the same code as a module in a larger daemon which roughly duplicates srvPowerControl's features (historical reasons.) This daemon is able to get the status of a player, and switch it back if it is off or stopped. I was already doing this with the defunct xml netcontrol interface (the original code was written for it), but overall using JSON is easier and it uses the same commands as the CLI (some differences here and there.) So performing about any query/command is now possible, in contrast to using the former XML/HTTP interface. If such features were to be included to a plugin, I suspect direct use of LWP:: and HTTP::Cookie would be redundant (SC already exchanges data with SN, eg preferences) and forbidden (synchronous communication.) This is a 100 lines script, I guess a better plugin for the same purpose would be expressed in 10 lines. Unfortunately, I don't know the SC ways for doing this. -- epoch1970 ------------------------------------------------------------------------ epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711 View this thread: http://forums.slimdevices.com/showthread.php?t=62029 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/plugins
