rmpb - Remote MP3 Playlist Builder * Overview rmpb is a pair of scripts: one that provides a web interface to a collection of MP3 music files on a server, and allows a web user to build a playlist of those files, and a second (a modified version of mp3stream, which can be found at http://www.corknut.org/code/mp3stream/) which streams the files to a remote client via the Shoutcast protocol. * Installation rmpb requires several things to work correctly, including a working installation of Perl (with CGI.pm and IO::Socket), a working installation of a webserver that is set up to allow script execution (I use Apache, available at http://httpd.apache.org), a working installation of the LAME tool (available at http://www.mp3dev.org/mp3/), some MP3 files, and some knowledge. I can't provide support for any of these, least of all the knowledge. But I can tell you how to get rmpb set up and running. 1. Extract the contents of the archive you downloaded. The resulting files should be: rmpb.pl - the web interface README - this file ministream.pl - a simple MP3 streamer chgdir.gif, up.gif, down.gif, add.gif, remove.gif, filter.gif, launch.gif - image files for the web frontend 2. Move rmpb.pl to a directory that can be accessed from your webserver and which allows execution of CGI scripts. I suggest creating a new directory for it, and protecting the directory using htpasswd and an .htaccess file. You can find information on doing this at http://httpd.apache.org/docs/howto/auth.html if you are using Apache. NOTE: If you leave this script publically accessible, malicious users could do bad things to your machine. I am in no way responsible for this. You have been warned. 3. Move ministream.pl to a secure location (your home directory should suffice). 4. Make sure both rmpb.pl and ministream.pl are executable (chmod a+x them). 5. Edit both files and change the variables in the "Configuration" sections to suit your setup. Make sure paths are correct, and all that. 6. Visit the rmpb.pl script on your webserver and try it out. If it doesn't work right, make sure you've set everything up correctly and try again. Read lots of docs. Don't email me unless you're sure that your Perl installation is working, your webserver is working, LAME is working, the files are set executable, your paths are correct, and you've rechecked everything about six times. 7. Have fun! * How It Works When you access the rmpb.pl script on your webserver, it immediately scans your MP3 base directory for files and directories, and populates the lists on the webpage with what it finds. If there are files, you can add them to your playlist, remove them from your playlist, or move them around within your playlist using the +, -, Up, and Down buttons. If you have a lot of files in one directory and you want to only view a portion of them, you can type a word or two into the Filter box and push the Filter button, and the resulting files displayed will be only the ones which have that word or words in their filename. When you're ready to stream the MP3s to your computer (you can play them using WinAmp (http://www.winamp.com), XMMS (http://www.xmms.org), or any other MP3 player that supports the Shoutcast protocol), you can change the Port value (if you want - generally, port 8000 is available, which is why it's the default), click the Randomise checkbox if you want your list of songs to be mixed up thoroughly before they're streamed, and then click the Launch button. When the Launch button is clicked, rmpb.pl writes your playlist to a file in the temp directory you have specified in the script, delivers a Shoutcast-style playlist to your browser, and launches ministream.pl, which waits on the port you have specified for a connection. If it doesn't get a connection in 30 seconds (default, or whatever value you have specified for the timeout) it dies. If you have WinAmp installed, it will generally autoconnect as soon as you push 'Okay' to open the Shoutcast playlist file. If you have XMMS, it's theoretically possible to set your browser up to do this as well, or else you might just have to open the server location (http://the.server.name:8000, or whatever) by hand. Once a client connects to ministream.pl, it downsamples the MP3s in your list and sends the MP3 data to the client, which should then play the MP3s. Once the playlist ends, the stream disconnects, ministream.pl exits and the temporary playlist file is deleted from the server. * Known Problems - If you attempt to run two streamers on the same port, the second one just won't work, but there will be no indication of this to the web user. This is why rmpb should probably be only available to a limited number of trustworthy users. - If one copy of ministream.pl is already streaming data to a connected client on a port, and a second copy is started on that port, the second copy will run fine but a client won't be able to connect to it. I'm not sure why it runs, but it does. - ministream.pl may choke on corrupted MP3 files. * Reporting Bugs, Suggestions, Etc. rmpb is pretty close to complete, but if you find any bugs, or have any questions or suggestions, please feel free to contact me (rfreebern@corknut.org) and let me know. I'm always trying to improve the script, if possible. -Ryan N. Freebern 15 Jan 2002