mp3_radio


mp3_radio

Main class for setting up an online mp3 radio.

License

Copyright (C) 2005 Ondrej Maly <lykantrop@yahoo.co.uk>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

You can found more information about GPL licence at: http://www.gnu.org/licenses/gpl.html

Dependencies

This class depends on mp3_filelist and mp3_idv.

Description

This class provides a simple Internet Radio functionality. There's a queue of mp3 files in the specified directory, which are served consecutively by each request. It holds the order of the files as they are uploaded. The files are deleted from the directory when they are sent. In fact, it's more a jukebox than radio :) It supports both Windows Media Player and WinAmp (and like), but WinAmp is more reccomended because it doesn't cache the files. (WMP hangs up on playing just one file again and again sometimes.) The player must be set to repeat continuously the 'track' and in case of WMP also to always connect to the Internet ('Options/Player/Connect to the Internet'). Then just select 'File/Open URL' and type in the Internet address of the script.

Usage

Invoke as frequently as Thou wilt:

<?php
require_once ( "class.mp3_radio.php");

$radio = &new mp3_radio();
$radio->play();
?>

That's all.

DOGMA (Constants and Variables)

(string) mp3_radio::cwd

Path where the script resides

RITUAL (Methods)

(void) mp3_filelist::mp3_radio()

Constructor. When called, it performs following actions. Sets the mp3_radio::cwd, erases last served music file and rebuilds the playlist (see mp3_filelist).

(void) mp3_filelist::play()

This is the only public method in this class. It prepares the headers and the content to be sent to the client. It behaves slightly differently according to the client application. When the client is the Windows Media Player, it sends a link to the file, in other cases it sends the whole file as desired by WinAmp for example.

(void) mp3_filelist::unlink_last()

Erases last served music file.

(string) mp3_filelist::link_encode (string $p_url)

function 'linkencode' by
dphantom@ticino.com
03-Feb-2002 03:48
found at php.net

Encodes properly the link to the music file. It takes an absolute URL as an argument.

 mp3_radio