Description:
creates .m3u song list from file system and query submitted from song_search box
Box Code:
use File::Find;
my $content;
my $search = $S->cgi->param('song');
my $list = $S->cgi->param('list');
my $re = qr/$search/i;
if ($list) {
$S->apache->content_type("audio/m3u");
$S->apache->header_out('Content-Disposition' => "attachment; filename=list.m3u");
}
find( \&getmp3, "/var/mp3/");
sub getmp3 {
if(/$search/)
{
my $name = $File::Find::name;
$name =~ s/\/var\/mp3/\/tunes/;
$content .= "http:\/\/www.codenoevil.com" . $name . "\n";
}
}
return '' unless $content;
return $content;
|