First some background story: A little under two years ago my mother was diagnosed with Stage 4 Bone cancer. Today she is paralyzed and bed-ridden. In an effort to keep her comfortable and relaxed, I have hooked up a custom music streaming device to play her favorite genre of music (classical) anytime she wants it. Radio reception and music selection is an issue in our region.
I started with a Raspberry Pi 2 Model B, a WiPi wireless adapter, an 8GB microSD card and a low cost case. I downloaded the SolydX RPi2 edition and extracted it onto the microSD card. Once done and inserted into the RPi2, I booted the system and followed the usual procedure for expanding the file system to use the entire SD card. Set up your network connection at this time if you are using the wireless adapter.
Now the fun can begin.
Open the Terminal and install VLC Media Player: sudo apt-get install vlc. When finished, close the Terminal window and open the web browser. Navigate to 181.fm and download the .pls file for your music choice. Mine being Classical Music. Save this file into your Music folder. Once that is done, you can open the .pls with VLC to make sure it is working properly for you. Everything fine? Now to the next phase.
To get VLC to open and start playing at startup, go to the Menu, locate Session and Startup under Settings, and open that utility. On the Application Autostart tab, click on Add. Now you can enter a Name "Classical on VLC", Description "181.fm Classical" and Command
bash -c "sleep 10 && /usr/bin/vlc --started-from-file /home/solydxk/Music/181-classical.xxxxxxxxxx.pls"
Replace the xxxxxxxxxx with the number from the .pls file that you downloaded.
If you chose a different station, replace the entire .pls file name with the file name you downloaded. Click on OK to save you new startup application. I use the sleep 10 command to give my wireless connection time to connect before VLC opens.
Restart your RPi2 and make sure that VLC opens after the right time delay and plays the correct station you selected. Happy with the results? Good. The only thing left for me was to plug an audio cable into the headphone output and the other end into the AUX input on my mother's Bose system, then boot the RPi2. Now she can listen to her favorite music anytime she wants just by turning on the Bose system.
One final and very optional step. Due to some issues with my home network dropping out at random times, the RPi2 will stop playing music every so often. To remedy this, I inserted a cron job to reboot the system every day at 4AM. To do the same, open the Terminal and type in gksudo mousepad /etc/crontab. This will open the crontab file in the default text editor. At the bottom of the list, add the following entry
00 4 * * * root reboot
Save and exit, then exit the Terminal.
That's all there is to it. Now Mom is happy listening to her favorite music anytime she wants.
About me: I have been using Linux since I first tried Ubuntu 7.04 which I hated, and soon found Linux Mint 4 more to my liking. I have been using Linux Mint as my main OS ever since, even converting some co-workers to Linux. I still use Windows for work, but Linux is all I use at home. I have used this same method to build streaming music players for different locations at work, using outdated desktop computer hardware, with great results, but I prefer the RPi for its silent operation and low power consumption.
This is a guest post, which took part in the contest from Linux notes from DarkDuck.
Order your own copy of
5 Nov 2015
DarkDuck is a person with whole life spent in IT area. It does not mean only Linux, but also SAP systems. Learn more about him here.
If you like this blog, please do not forget to share or put it into your favourites:
You can also subscribe to this blog via e-mail or RSS, links are on the right. This is absolutely FREE!
Posted by DarkDuck at 21:57