Totally, I've been having similar thoughts, just lack of time to implement ;)
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/b3a86a19-90d7-428b-894b-7217bde07638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/612a12e5-4934-4a8c-83a9-5a717a649529%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/612a12e5-4934-4a8c-83a9-5a717a649529%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/548EF1CB.2010204%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAK2Uy1qvdDRDn_HUf%2BQU7cX5GszrKvfM%3DVbmLT40gEnxMn%2B3og%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/1B2462F3-C69D-4BF6-B726-370D5EB27685%40gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "LightshowPi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAK2Uy1pNrZypB4%2BVuYZT3vEnvv2ndWSw4kvubYFKM9SzGite%3Dg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAGErOzEdOxz7pEfw5P0xrEUBg70D5OQ-wOj%2B7SfREFGOyJtchw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/EFAC1D02-BF09-4670-B935-EFF486822AF5%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAGErOzFGMvJkeGLj2P7-cY-igLh6KASL4fb-sz26mFBfeFz-RQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAK2Uy1qvdDRDn_HUf%2BQU7cX5GszrKvfM%3DVbmLT40gEnxMn%2B3og%40mail.gmail.com.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/1B2462F3-C69D-4BF6-B726-370D5EB27685%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to a topic in the Google Groups "LightshowPi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAK2Uy1pNrZypB4%2BVuYZT3vEnvv2ndWSw4kvubYFKM9SzGite%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAGErOzEdOxz7pEfw5P0xrEUBg70D5OQ-wOj%2B7SfREFGOyJtchw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to a topic in the Google Groups "LightshowPi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/EFAC1D02-BF09-4670-B935-EFF486822AF5%40gmail.com.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/CAGErOzEdOxz7pEfw5P0xrEUBg70D5OQ-wOj%2B7SfREFGOyJtchw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to a topic in the Google Groups "LightshowPi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/EFAC1D02-BF09-4670-B935-EFF486822AF5%40gmail.com.
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to the Google Groups "LightshowPi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/2b185867-77a0-42cb-89cd-ee796a39bb25%40googlegroups.com.
Tom, took a quick look - how would you define a service using python-twisted on the server side but using other languages for building the clients?
--
http://www.lightshowpi.com/
---
You received this message because you are subscribed to a topic in the Google Groups "LightShow Pi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/85fc51f2-1e02-45fd-b2e1-b867a1496435%40googlegroups.com.
Twisted definitely looks interesting. Building a good server is hard work, so using an existing one makes a lot of sense.I thought twisted was only for web serving, but it looks like a perfect fit for a daemon like this.
Has anyone considered not reinventing the wheel?--python-twisted https://twistedmatrix.com/trac/This might also be an option to the socket interface. One server that could work with many interfaces.
On Saturday, December 13, 2014 11:45:56 AM UTC-8, Micah Wedemeyer wrote:With people building web UIs, phone UIs, and other interfaces, I was wondering if it might be useful to have a control daemon that listens on a socket. Clients could control the music, lights, and such by sending messages to the socket. A socket interface would allow writing clients in other languages besides Python, and just generally make it easier to integrate with the underlying lightshow codebase.Any thoughts on this?
http://www.lightshowpi.com/
---
You received this message because you are subscribed to a topic in the Google Groups "LightShow Pi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/oW1wLcnEz7Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-dev+unsubscribe@googlegroups.com.
To post to this group, send email to lightshowpi-dev@googlegroups.com.
I've been reading/thinking about this a lot more lately, and I have some more thoughts I'd like to run by the group.
Thrift
After looking over Protocol Buffers, Twisted, and various other communication methods, I found Thrift. It's very similar to Protocol Buffers, but goes the extra distance to provide a pre-made RPC layer. I experimented with creating a Thrift server to turn the lights on and off and had great success very quickly.
By using Thrift, we could create a server that listens for messages from clients written in any language that supports Thrift, and there are quite a few. So, I'm going to start working toward that end. I'll begin posting some Thrift definitions to get feedback.
Server / Daemon Structure
As part of daemonizing the code, I think there's an opportunity to refactor and separate some of the pieces a little. In particular, I'd like to re-envision the song playing as a pipes-and-filters approach. Instead of a single function that's in charge of doing everything (ie. play_song), it would be broken into smaller pieces that do a small bit of work and then put that into an output buffer that the next piece in the chain consumes. So, more like an assembly line where each worker does a small part that is then passed on to the next worker.
For example, here's a possible chain:
Each of those pieces would be its own little worker, and they would communicate via buffers that they read and write to.
A big plus of this is the ability to pull a piece out of that chain and replace it with something else that has the same inputs and outputs. For example, we could replace reading and decoding the mp3 file with another audio in source (like USB in or a Pulse Audio server) and leave the rest of the chain intact. Likewise, we could have alternate audio-to-light-channel analyzers that could be swapped in as well.
Finally, I would go so far as to make each worker a separate thread, and just ensure that the buffers used between them are thread safe. Even though the r-pi is a single core (right?) they will still work well in pseudo-parallel, and it will allow other work to be done when it's blocked on i/o, like when it's reading the audio stream or when it's actually playing the music and lights. Each worker would just continue consuming and filling its i/o buffers until one is empty or the other is full.
I'm going to start working on these items (Thrift and Daemon) on a fork. If anyone has feedback or thoughts, I'd love to hear it.