Mood Switch is a project I have been working on for the past month or so.
I bought myself an amp for Christmas with bluetooth connectivity so I could wirelessly play music off of my phone.
When I opened the box I was surprised to find that it came with a remote control.
That got me thinking: wouldn't it be a lot easier if I just had music playing on a device at all times?
That way I could have music playing with a couple of button clicks instead of having to fiddle around setting up streaming on my phone every time I got out of the shower or wanted to listen to music before going to bed.
The project is mostly written in Python but there are a couple of bash scripts that wrap the Python code to help daemonize the program.
These scripts are set to run when the Pi boots-up and can start/stop/restart the process as needed as well as restart the streaming program in the event that bluetooth connectivity is lost (which occurs more frequently in the dorms than when I was testing Mood Switch in my house over break).
It is designed to persistently play music for the ease of use of the end user.
The reason I chose to write this in Python is because I initially wanted to stream Google Music to the Pi and the most complete unofficial Google Music API available right now is written in Python.
I managed to authenticate with the Google Music service by tricking it into thinking the Pi was my old Android tablet.
Although the service would give me song and playlist information in the form of JSON payloads, the streaming locations it would provide where always unavailable.
Out of this failure, I reworked the music playback system to be more generic.
Right now I have two plugins written, one for local music playback and one to handle OGG online radio streams.
These services provide the music playback system with available playlists and each playlist consists of streaming information per song (the radio service provides one stream per playlist/station).
Current music state information, such as the currently playing playlist and shuffle state are broadcast over the speakers via a text-to-speech synthesized voice.
The TTS program I use is slow so I generate the speech files as needed when the playback program initializes and all speech files are cached to the Pi's storage and are played on state change.
It is worth noting that I initially wanted Mood Switch to control the light switch in my room via the remote as well.
As of writing, the light switch feature is only partially implemented.
I have a test script that can move the servo on the Raspberry Pi.
However there were a few issues: