I wrote a little Python script which I thought someone might want to use as well.
I have a media center running based on the raspberry pi and had two major "problems":
-Having to stand up to power the amplifier
-Leaving the amplifier on even though no music played
That is why I wanted the Pi to switch a remotely switchable socket-outlet with its GPIO Pins (I used this one: bit.ly/10jRKs9)
You need the RPi.GPIO (http://bit.ly/JTlFE3) module installed as well as pyinotify (http://bit.ly/bgDoS). Pins 17 and 18 are used for switching (assuming that both pins switch active high inputs!). Depending on your sound output device you might want to change the line
Code: Select all
wdd = wm.add_watch('/dev/snd/pcmC0D0p', mask, rec=True)For system startup you may want to add it to your startup items.
Now here is the script:
http://snipt.org/zjhY4