So far I have just created 3 classes to make the proof of concept code into reusable modules.
mouseevent.py, pianobar.py, google_cal.py
The mouseevent class starts a thread inside it and thus creates an event loop to trigger methods like onMouseUp when you inherit from mouseevent.
The pianobar class takes the work from http://www.instructables.com/id/Pandoras-Box-An-Internet-Radio-player-made-with and turns it into a class with methods like start, volUp, volDown, pause, etc
The google_cal.py allows you to override a method called handleEvent(calname, event) which is passed each event as the weeks calendar is iterated over from google. This class may turn into a data structure that calles an onChange method.
The code is being hosted in a private repository on github right now, I suppose I could make it public if there is ever any interest.
Some random notes on installing what I am calling monkey clock (not sure about my apparent fascination with monkeys, but...)
From a fresh Raspbian system these are the commands to get the system setup to play audio and read mouse events.
First we will do the typical refresh of install.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Now lets install the packages that I seem to auto install (I probably dont need these but...)
- vim for editing files in a civilized manner
- build-essential g++
- autoconf - autoconf for configure files
sudo apt-get install vim build-essential autoconfThese packages are needed for various things for an alarm clock
- ntpdate to keep the date and time correct
- pianobar to play pandora
- python-dev you will need to install evdev
- mplayer to play mp3 files.
sudo apt-get install python-dev ntpdate pianobar mplayer
Install google api and evdev (for mouse events)
sudo pip install --upgrade google-api-python-client
sudo pip install evdev
If you are plugged in to an hdmi port and want to hear output from speakers you will need to tell it to send the output that way
You are going to want to have the device be headless so lets enable ssh so that we can log in remotely.#if you have your hdmi setup as the output for audio set it to the headphone jack
amixer cset numid=3 1
https://www.raspberrypi.org/documentation/remote-access/ssh/
Note that we are going to want to disable password login in /etc/ssh/sshd_config and create keys to login https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
In the stock /etc/ssh/sshd_config you want to set the following line to turn off ssh passwords "PasswordAuthentication no"