Apache-MP3
view release on metacpan or search on metacpan
return OK if $self->r->header_only;
print start_html(
-lang => $self->lh->language_tag,
-title => $self->x('Quick Help Summary'),
-dir => $self->lh->direction,
-head => meta({-http_equiv => 'Content-Type',
-content => $self->html_content_type
}
),
-script =>{-src=>$self->default_dir.'/functions.js'},
);
my $help_img_url = $self->help_img_url; # URL for the image
my ($url,$width,$height) = $help_img_url=~/(.+):(\d+)x(\d+)/;
$url ||= $help_img_url;
$width ||= 500;
$height ||= 400;
print img({-src => $url,
-alt => "",
-height => $height,
-width => $width,
$self->aleft,
}), "\n";
print join "\n".br(),
$self->help_figure_list
;
print "\n", end_html();
return;
}
sub help_figure_list {
my $self = shift;
# Provide a legend for the items in the figure
return(
b("A"). $self->x("= Stream all songs"),
b("B"). $self->x("= Shuffle-play all Songs"),
b("C"). $self->x("= Stream all songs"),
b("D"). $self->x("= Go to earlier directory"),
b("E"). $self->x("= Stream contents"),
b("F"). $self->x("= Enter directory"),
b("G"). $self->x("= Stream this song"),
b("H"). $self->x("= Select for streaming"),
b("I"). $self->x("= Download this song"),
b("J"). $self->x("= Stream this song"),
b("K"). $self->x("= Sort by field"),
);
}
sub run {
my $self = shift;
my $r = $self->r;
my(undef,$uribase) = fileparse($r->uri);
my(undef,$filebase) = fileparse($r->filename);
my $local = $self->playlocal_ok && $self->is_local;
my $base = $self->stream_base;
local $CGI::XHTML = 0;
# check that we aren't running under PerlSetupEnv Off
if ($ENV{MOD_PERL} && !$ENV{SCRIPT_FILENAME}) {
warn "CGI.pm cannot run with 'PerlSetupEnv Off', please set it to On";
}
# this is called to show a help screen
return $self->help_screen if param('help_screen');
# generate directory listing
return $self->process_directory($r->filename)
if -d $r->filename; # should be $r->finfo, but STILL problems with this
# simple download of file
return $self->download_file($r->filename) unless param;
# this is called to stream a file
if(param('stream')){
return $self->stream;
}
# this is called to generate a playlist on the current directory
return $self->send_playlist($self->find_mp3s)
if param('Play All');
# this is called to generate a playlist on the current directory
# and everything beneath
return $self->send_playlist($self->find_mp3s('recursive'))
if param('Play All Recursive') ;
# this is called to generate a shuffled playlist of current directory
return $self->send_playlist($self->find_mp3s,'shuffle')
if param('Shuffle');
# this is called to generate a shuffled playlist of current directory
return $self->send_playlist($self->find_mp3s,'shuffle')
if param('Shuffle All');
# this is called to generate a shuffled playlist of current directory
# and everything beneath
return $self->send_playlist($self->find_mp3s('recursive'),'shuffle')
if param('Shuffle All Recursive');
# this is called to generate a playlist for one file
if (param('play')) {
my $dot3 = '.m3u|.pls';
my($basename,$ext) = $r->uri =~ m!([^/]+?)($dot3)?$!;
$basename = quotemeta($basename);
my @matches;
if (-e $self->r->filename) {
# If the actual .m3u file exists (it's a playlist), then we read it
# to get the list of files to send
@matches = $self->load_playlist($self->r->filename);
} else {
# find the MP3 file that corresponds to basename.m3u
@matches = grep { m!/$basename[^/]*$! } @{$self->find_mp3s};
}
if($r->content_type eq 'audio/x-scpls'){
open(FILE,$r->filename) || return 404;
$r->send_fd(\*FILE);
( run in 1.285 second using v1.01-cache-2.11-cpan-39bf76dae61 )