loading

Do you like to listen to music or news? Are you a Linux user? If yes, this project may interest you.


Overview

This project shows you how to implement your own on-line radio receiver in Linux, using as major basis the mplayer application. Mplayer will operate in slave mode and receive commands by named pipes. It's possible to make this project work both in embedded and non-embedded Linux. It means that, if your Linux system has audio output, it's able to run Python scripts and runs mplayer application, you're ready to implement it easily.

Step 1: Python Checking

Before implementing this project, some preparation is necessary.


Be sure your Python version is 2.7 (for later versions, please check compatibility of functions print and raw_input).


Step 2: Installing Mplayer

In Debian-based distros (it includes Ubuntu and Raspbian), it can be done by the following command:

sudo apt-get install mplayer2

Step 3: Choosing On-line Radios

Now it's time to choose the on-line radios to listen to.

A very good website to get some radios is Shoutcast.
Especifically to this project, the on-line radio's URL must be a .pls playlist file. Here are three examples of valid on-line radio's URLs:

http://yp.shoutcast.com/sbin/tunein-station.pls?id...

http://panel3.serverhostingcenter.com:2199/tunein...

http://yp.shoutcast.com/sbin/tunein-station.pls?i...

Step 4: Testing Mplayer

To ensure your mplayer is ok, it must be tested in playing on-line radio you want to listen to.

To do this, considering on-line radio URL equal http://panel3.serverhostingcenter.com:2199/tunein... type the following command:

mplayer -playlist http://panel3.serverhostingcenter.com:2199/tunein...

Step 5: Talking Is Cheap. Show Me the Code!

Now it's time of coding this project on! The complete source-code sattached here in this step.

To run it, simply type:
python OnLineRadioReceiverLinux.py

Step 6: It's Alive!!!

Now your on-line radio receiver is alive!

Do you want to check this project alive? See these two following videos:


About This Instructable

514views

16favorites

License:

More by phfbertoleti:On-line Radio Receiver in Linux MQTT and Intel Edison - Intro Intel Edison - Creating Socket TCP program using GCC and Linux 
Add instructable to: