2

After a long break from writing software, I've started contributing to a home automation project by adding a squeezeboxserver client, written in Python.

I've got some basics working - on/off, play/pause/stop - but what I really want to do is be able to respond to events from squeeze server.

There's a listen/subscribe rpc method available:

curl -i -X POST -d '{"id":1,"method":"slim.request","params":["",["listen", "1"]]}' http://127.0.0.1:9000/jsonrpc.js

I'm stumped as to where to start to write the Python code, to do the following:

  • Make the call and listen for any notifications

I've looked at Twisted; looks like it would help, but can't quite seem to figure out what's going on.

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • Have you looked into micro-frameworks such as web.py or flask. – Ifthikhan Mar 29 '13 at 09:05
  • Thanks - It's more how to go about building a client which can listen to the stream being sent back whenever the server issues a notification, rather than building a web i/f. – user2223721 Mar 29 '13 at 13:16
  • It seems I mis-understood - json-rpc being a request-response interface won't give me what I need. – user2223721 Mar 29 '13 at 16:11
  • https://github.com/jingleman/PyLMS gives me access to the commmnd line interface though, which will enable me to subscribe to the notifications I want. – user2223721 Mar 29 '13 at 16:11

0 Answers0