Sunday, June 10, 2012

Slow Cooker + Fridge Speakers

The iPod finally gave up all the way. The screen still works but it doesn't play audio even if it's cold. As a stop-gap in the awesomeness that is fridge speakers, I had been using the "brypod" to play the fridge music, but I wanted that back for listening to music in other places. So I took the old Gateway computer I have, put a fun version of Linux on it, and made it play the music in the fridge. As a bonus: This computer also has a parallel port (a consequence of it being about 12 years old) which I will eventually use to control other things in the kitchen over the internet, such as the slow cooker. This is how I did it!

First! I downloaded the Ubuntu 12.04 x86 (32-bit) alternate desktop installer and burned it to a CD-RW and used that to install Ubuntu to the Gateway. This led to a problem that is becoming worse and worse with Ubuntu: despite having an "alternate installer" for old computers that don't have enough system resources to run the GUI, it's either impossible or very difficult to boot it to a command-line interface once it is installed. To me, this seems to defeat the purpose of having an alternate installer, but I also don't claim to be any sort of Linux expert. But any way! I spent about two hours coaxing the resource hog of a GUI into a terminal window so I could do something useful.

sudo apt-get install lxde

This installed a new GUI called LXDE which is extremely efficient and light-weight (unlike GNOME/Unity), without being downright unusable and terrible (unlike Fluxbox). After logging out and logging in to my LXDE session, I was able to actually use the computer.

sudo apt-get install ssh vlc x11vnc build-essential ubuntu-restricted-extras
sudo apt-get update
sudo apt-get upgrade


This installed all the system updates as well as the tools I will be using on this computer:
  1. VLC, a versatile media player (easier to manipulate than my personal preference, Rhythmbox)
  2. SSH, which allows me to login to the computer remotely via command-line
  3. X11VNC, which gives me remote desktop control (so I don't have to have a monitor/keyboard hooked up to the computer).
I needed to configure the remote desktop software to start automatically at boot.

x11vnc -storepasswd

It is necessary to have a password. Next: I went to ~/.config/autostart and created a shortcut named X11VNC.desktop. (It is necessary to create the autostart directory if it does not exist already.) The file should look like this:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X1VNC
Comment=
Exec=x11vnc -forever -usepw -httpport 5900
StartupNotify=false
Terminal=false
Hidden=false


The next step is to configure the login options:
sudo nano /etc/lightdm/lightdm.conf

Now I need to configure the computer to automatically log in to an LXDE session when it starts up, so I don't have to type in a user name and password. I changed the lightdm.conf file from this:

[SeatDefaults]
user-session=ubuntu
greeter-session=unity-greeter


to this:

[SeatDefaults]
user-session=lxde
greeter-session=unity-greeter
autologin-user=bryan
autologin-user-timeout=0


The next step is to install folder sharing software (samba) so I can easily drag and drop music to the computer for my refrigerator listening pleasure. I decided to share the Music folder (~/Music) over the network. (I could have used SSH to do this, but it's a lot easier to drag-and-drop).

Once all the music I wanted was on the computer, I moved all the .mp3 files to one folder and created an .m3u playlist:

ls -d * | grep .mp3 > "${PWD##*/}.m3u"

This creates a file called ~/Music/Music.m3u. The final step is to tell the computer to start VLC when it boots, AND play this playlist file when it starts the program, AND turn on repeat and shuffle. This was accomplished by making a file called vlc.desktop and placing it in the autostart folder.


[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=vlc
Comment=
Exec=vlc /home/bryan/Music/Music.m3u --random --loop
StartupNotify=false
Terminal=false
Hidden=false


That's it! Now the computer plays fridge music, is accessible remotely by VNC, SSH, and Samba, and is ready to start controlling things in the kitchen over the internets!

No comments:

Post a Comment