My Open Radio
By Mark Nielsen
- Setting up Apache
- Using Grip to Rip
- The Python Script
- Play the List
I am sick of playing cds. Half the songs on a cd suck. I don't like switching
cds in and out. I am sick of commercial radio with their stupid mid-life
crisis hosts who try to appeal to teenagers by trying to act like them (grow
up). I like to listen to music (from cds)
or shows on NPR as background noise while I
program. I decided to develop a way to make my computer play songs and NPR
shows as though it were a radio. This will eliminate cds and commercial radio
I want my computer to play this stuff in
a random order. The first thing I wanted to do was rip songs from my cds
and play them in a random order.
The second thing (which is not in this article) was to download
a playlist of all the shows I like to listen to on NPR
(I hope someday NPR will accept my offer to develop playlists (as my donation)
for their listeners).
For now, I am keeping things really really simple. In the future, I plan
to add playlists, give songs weight, put stuff into a PostgreSQL databases,
add accounts, etc.
I am very lazy. So lazy, I didn't bother to look long at the various web-based
mpeg organizers of your favorite songs. I just wanted something to spit out
200 songs in a random order so that it simulates a radio station. I first
had to rip the songs and then write a simple
Python script to split out a playlist.
On your Linux server, find your html root directory for your httpd server.
On some systems, this is located at "/var/www/html". Assuming that it is,
Now copy all of your mp3, rm, wav, or other audio files into the directory
"/var/www/html/audio". NOTE: Do you not use your web server for anybody
but yourself. Only you may listen to these songs or you may get into
copyright problems. Contact an attorney for issues regarding legal issues.
To start your webserver, usually you can do this "service httpd start".
If that doesn't work, then look at the documentation that came with your
Linux distribution to figure out how to start and stop the web service.
Usually the default web server on most Linux systems with be Apache.
Using Grip to Rip
After looking at many programs, Grip seemed to be the easiest to use to
rip songs from a cd. It organizes the songs by author and album. Nice.
Here are the steps I used to configure Grip.
- Download and install "LAME" from http://www.mp3dev.org. Be aware of
any patent issues.
lynx --source http://twtelecom.dl.sourceforge.net/sourceforge/lame/lame-3.93.1.tar.gz > lame-3.93.1.tar.gz
tar -zxvf lame-3.93.1.tar.gz
ln -s /usr/local/lame/bin/lame /usr/bin/lame
- Start Grip.
- Configure Grip. Under the "Config" menu, do this.
Click on Encode, choose 'lame' as the encoder. Where is says "Encode
File Format" make sure you specify the directory "/var/www/html/audio" as the
base directory. Mine looked like this '/var/www/html/audio/%A/%d/%t_%n.mp3'.
- Click on "Tracks" in the top menu and select the tracks you want to rip.
- Click on "Rip" in the top menu and then click on "Rip + Encode".
The Python Script.
Put this python script at "/var/www/cgi-bin/playlist.py". Execute this
command after putting it there "chmod 755 /var/www/cgi-bin/playlist.py".
After you have properly installed this python script (please use Python 2.2)
and you know it works right, you might have to change the url from 127.0.0.1
to the ip address of your computer for the network so that other computers
in your house can play the music as well.
Play the List.
Personally, I use Real Player. I tried to use xmms, but it didn't work for
some reason (with the mpegurl list).
Real Player accepts both smil and mpegurl, so I just use it.
I would like to switch to some free GPLed player instead someday.
Just type this into your browser, Real Player, or whatever other player you
are using "http://127.0.0.1/cgi-bin/playlist.py".
This little setup is perfect for me. In the future, I want to create
accounts, playlists, keeping track of which songs haven't been played yet,
give a song weight, and a bunch of others things. For now, I am finished
with this and will move onto making a playlist of my favorite NPR shows.
I am big ideas of where this could lead. Since I have a lot of unfortunate
it seems like something could develop here. I heard a lot of stuff about
internet radio stations, but it seems like none of them are really
approaching the market right. They seem to be stuck in the old days of
radio. They need to move forward and not be constrained by the media giants
(legally). It seems like the internet radio stations don't see the big
picture. For now, I am just going to develop my own little radio for myself
and maybe do something with it for real later.
If this article
changes, it will be available here
Mark Nielsen works at
Crisp Hughes Evans.
In his spare time, he writes articles relating to Free Software (GPL) or
Free Literature (FDL). Please email him at email@example.com
and put in the subject "ARTICLE:" or the message will be deleted and not
even looked at -- to stop spammers.
Copyright © 6/2003 Mark Nielsen