On-line Radio Receiver in Linux

Published

Introduction: On-line Radio Receiver in Linux

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:


Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Woodworking Contest

      Woodworking Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    4 Comments

    I run an old Linux , Puppy Precise 5.7.1 and your site just plays without the python program so whats it needed for?

    Kernel 3.9.11

    Hi there!

    When you say it plays without python program, you mean mplayer can play online radio alone only?

    Yep . I can play all of the referenced stations now simply by going there

    Tytower, I think I know what's the reason of your problem. In old Linux (a.k.a. Old Kerbel version) named pipes weren't created by mkfifo command. To create named pipe files, mknod command were used instead. Try replacing it and test it again.