MP3::Icecast 0.02 review

Download
by rbytes.net on

MP3::Icecast is a Perl module to generate Icecast streams, as well as M3U and PLSv2 playlists. SYNOPSIS use MP3::Icecast;

License: Perl Artistic License
File size: 33K
Developer: Allen Day
0 stars award from rbytes.net

MP3::Icecast is a Perl module to generate Icecast streams, as well as M3U and PLSv2 playlists.

SYNOPSIS

use MP3::Icecast;
use MP3::Info;
use IO::Socket;


my $listen_socket = IO::Socket::INET->new(
LocalPort => 8000, #standard Icecast port
Listen => 20,
Proto => 'tcp',
Reuse => 1,
Timeout => 3600);

#create an instance to find all files below /usr/local/mp3
my $finder = MP3::Icecast->new();
$finder->recursive(1);
$finder->add_directory('/usr/local/mp3');
my @files = $finder->files;

#accept TCP 8000 connections
while(1){
next unless my $connection = $listen_socket->accept;

defined(my $child = fork()) or die "Can't fork: $!";
if($child == 0){
$listen_socket->close;

my $icy = MP3::Icecast->new;

#stream files that have an ID3 genre tag of "jazz"
while(@files){
my $file = shift @files;
my $info = new MP3::Info $file;
next unless $info;
next unless $info->genre =~ /jazz/i;
$icy->stream($file,0,$connection);
}
exit 0;
}

#a contrived example to demonstrate that MP3::Icecast
#can generate M3U and PLSv2 media playlists.
print STDERR $icy->m3u, "n";
print STDERR $icy->pls, "n";

$connection->close;
}

ABSTRACT

MP3::Icecast supports streaming Icecast protocol over socket or other filehandle (including STDIN). This is useful for writing a streaming media server.
MP3::Icecast also includes support for generating M3U and PLSv2 playlist files. These are common formats supported by most modern media players, including XMMS, Windows Media Player 9, and Winamp.

Requirements:
Perl

MP3::Icecast 0.02 search tags