home   articles   archive   forum   masthead  
Published at 25.1.2000
Author: Ronny Ziegler
Translator: Andy Ziegler
Languages: de nl
Printer printer-version
Support Us!
 

Web-Jukebox: IceDJ

A broadcast music station is wonderful, but a broadcast station where you can vote for your favorite music is even better.
With IceDJ, everyone can vote for songs and the broadcast station becomes a World Wide Jukebox.

Abilities

IceDJ is a collection of CGI scripts which steer an existing Icecast server via a web browser.
The program works like a Jukebox: From a list of all offered songs you can select your preferred song. These will be played when their time comes.
In addition, you can play special broadcast programs at a specific time, e.g. every day at the same time, the top 10 songs can be repeated.

Installation

Unfortunately, the installation of IceDJ is not easy, but you can manage it. This program follows the same rules as previous programs:
After you fought through the installation it will work until eternity ends without any trouble.
First get IceDJ from the page:
http://www.remixradio.com/icedj/
The actual version we reviewed is 0.9.14 and the following installation is based on this version.

The file should be unziped and untared into the /tmp directory:

  >> tar zxvf icedj-0.9.14.tar.gz -C /tmp/
  
Then, the created directory has to be copied to the web server by the web administrator (usual wwwadmin). In the SuSE distribution, the directory for the web server is located at /usr/local/httpd/.
  >> cp -a /tmp/icedj-0.9.14/ /usr/local/httpd/htdocs/icedj
  >> cd /usr/local/httpd/htdocs/icedj
  
You start IceDJ via the program icedj.pl. It searches for the perl interpreter at /opt/bin. However, this is not the usual place for perl in the major Linux distributions, so you have to edit the first line of the script to
   #!/usr/bin/perl
  
or wherever you keep your perl interpreter.

Next, you have to create a configuration file which will be used by icedj.pl later. You copy the included file

  >> cp data/example.conf data/MyOwnRadio.conf
  
and modify it to your wishes; most of the settings are clear. In the following list, you find all entries that have to be changed:

data/MyOwnRadio.conf
   #The name of the broadcast station
   name		NetMag Broadcast
  
   #The genre of the offered music
   genre		various
  
   #The URL the server is running on
   url		http://www.linuxnetmag.de
  
   #Name of the server Icecast is running on. Usual the
   #same computer as for IceDJ. Here you should take the
   #IP number to avoid problems in local network
   server		192.168.1.1
  
   #The port which is used by Icecast. In our example 8010.
   port		8010
  
   #If you do not want to be publically listed use
   public		0
  
   #The bitrate of the mp3 files (in local networks 128 bit)
   #You can only choose one rate and just these mp3 are played.
   bitrate		128
  
   #The password you chose in the Icecast configuration to be
   #the Admin_Passwd.
   password	mypassword
  
   [...]
  
   #The directory where the mp3s are located 
   mp3root		/tmp/mp3/
  
   #You should comment the next entry
   #source
  
   #The directory in which the IceDJ websites shall be copied
   webroot		/usr/local/httpd/htdocs/icedj/web/
  
   #Your e-mail address if any error occurred
   email		webmaster@linuxnetmag.de
  
   #Usually a visitor can choose a maximum number of songs.
   #Here you can exclude IPs from this restriction
   specialip	255.255.255.255 128.128.128.*
  
   #Users who are excluded using IceDJ are placed here
   blockip		192.168.13.24
  
   #We want to be a calm station, so
   updateMP3spy	0
  
   [...]
  
   #If you do not want any statistics, comment the following lines:
   #serverlog      http://icecast.yourserver.com/~icecast/iceca...
  
   #server statistics  <multi>
   #serverstat	 http://icecast.yourserver.com/~icecast/icecas... 
  
   [...]
  
   #The directory where the icedj scripts are placed
   scriptpath /usr/local/httpd/htdocs/icedj/
  
   #The path to the program shout
   streamer /usr/local/icecast/bin/shout
  
  

Now you have to build a playlist from which you can choose. This file is located in the subdirectory data. In it, you write the mp3 name, the artist, the title of the song and if you want, you can add a correspond ing internet site.
All entries have to be separated by a tab. Use always one tab or IceDJ will interpret the second tab as an empty entry. The entries will not be aligned well and the table will become very chaotic:

data/playlist -- examples
  Sting__Fields_Of_Gold.mp3	Sting	Fields Of Gold	http://www.sting.uk
  Along_Comes_Mary.mp3	Bloodhound Gang	Along Comes Mary
  

Last, you have to put the template files which IceDJ uses to generate the HTML sites. These sites are in the subdirectory web.
You have to change the entry

  <A HREF="http://www.yourserver.com/cgi-bin/request.pl?conf=<!conf>&uniqueID=<!uniqueID>"><!title></A>
  
to a link to your server. In our installation to
  <A HREF="http://my.server.de/icedj/cgi-bin/request.pl?conf=<!conf>&uniqueID=<!uniqueID>"><!title></A>
  
Now you configured the complete system and IceDJ can be started for a first test.
First start the Icecast server (on port 8010):
  >> /usr/local/icecast/bin/icecast -P 8010
  
and then the IceDJ script. This script is executed together with the path to the configuration file:
  >> ./icedj.pl data/MyOwnRadio.conf  
  
If everything worked as planned, IceDJ started to transmit mp3 music to the shoutcast server:

IcedDJ Output
  reading config from data/MyOwnRadio.conf
  
  -----------------------------
    i c e d j - Version 0.9.14
  -----------------------------
  
  IceDJ comes with NO WARRANTY, to the extent permitted by law.
  You may redistribute copies of IceDJ under the terms of the
  GNU General Public License.
  For more information about these matters, see the file named COPYING.
  
  -----------------------------
  
  Initializing Playlist...
  
  Spawning Shout...
  starting 128Kbps stream...
  Playing /tmp/mp3/Along_Comes_Mary.mp3
  [3:20] Size: 3203239 Bitrate: 128000 (41067 bytes/dot)
  [...playing  Along Comes Mary by Bloodhound Gang
  .....Updating Webpages...
  

At the same time IceDJ start to create the web sites and copies them to the server.

Web sites

You find the created pages on the server in the subdirectory /icedj/web/.
Select the page /icedj/web/playlist.html. At the end of this page you find a list of all songs that are listed in the file /data/playlist. To select a title for the jukebox just click on the link.
If you got a browser to download a file instead of a new HTML site, your apache web server would not be correctly configured because it does not recognize the CGI script as an executable.
The needed configuration is described below (also see the article Apache the web server).
In the file /etc/httpd/srm.conf (or wherever you have your apache configuration file) you need an entry in the part ScriptAlias:

File /etc/httpd/srm.conf
   # ScriptAlias: This controls which directories contain server scripts. 
   # Format: ScriptAlias fakename realname 
  
   ScriptAlias /cgi-bin/ "/usr/local/httpd/cgi-bin/" 
   ScriptAlias /icedj/cgi-bin/ "/usr/local/httpd/htdocs/icedj/cgi-bin/"
  

Here you have to add the directory where the IceDJ scripts are placed.

The changes are activated after a restart of apache (as root of course):

  >> /sbin/init.d/apache restart
  
or you could reboot the whole system if you did not find the init script.
Now try to click on a song at the playlist.html again. If you get an error message like the following one instead of a download browser,

Error message

Forbidden

You don't have permission to access /icedj/cgi-bin/request.pl on this server.


Apache/1.3.3 Server at mein.server.de Port 80

then the right of the CGI scripts would not be set correctly.
A short

  >> chmod o+x request.pl
  
allows all visitors of your web site to execute the scripts.
In addition the visitors need write access to the data directory:
  >> chmod o+w data
  
Also, you have to change line 57 of the script cgi-bin/reques.pl :
  $CONF{'datadir'} = "$DOCROOT/data/";
  
Here you should use the absolute path to the data directory:
  $CONF{'datadir'} = "/usr/local/httpd/htdocs/icedj/data/";
  

Fine tuning

Everything should work now. The default templates which are used to create the HTML sites are quite dark and include a lot of unnecessary statistics.
To modify the generated pages to suit yourself, you have to edit the template file in the web subdirectory with a common text editor. If you want to save some time you could download the templates which we changed and used. (download templates).
After making a backup of the template files you can overwrite the old ones.
You can change the templates while IceDJ is running because it accesses the files only every few seconds.

Now you can build a connection to the Icecast server with a mp3 player and select the wanted title via the web site, and that worldwide.
We do not want to forget to mention additional problems.
Next to the complicate installation, the program can only play mp3 files with a single, particlar bitrate. If a song becomes paused again and again, the problem could be that it was encoded with a different bitrate that the chosen setting.
You also should not start IceDJ automatically during booting (e.g. via an init script). If it did not find one of the files listed in the playlist, it would try to load it again and again using more and more RAM and finally all RAM and swap is used and the system hangs.
Always start IceDJ by hand or be really sure that the mp3 files are always at the same place.


Links:
Homepage IceDJ: http://www.remixradio.com/icedj/




Talkback Area




Enter Own Comment