#!/usr/bin/perl -w
#
# tiny browser for podcasts/RSS
#
# Copyright Jeff R. Allen ", firstExisting($_, 'itunes:subtitle', 'description');
if ($_->{'media:group'}) {
my @c = @{$_->{'media:group'}->{'media:content'}};
foreach (@c) {
if ($_->{'type'} eq 'video/x-flv') {
my $w = $_->{'width'};
my $h = $_->{'height'};
my $u = $_->{'url'};
print vPlayer($u, $w, $h);
}
}
} elsif ($_->{'enclosure'}) {
if ($_->{'enclosure'}->{'type'} eq 'video/flv') {
print vPlayer($_->{'enclosure'}->{'url'});
} elsif ($_->{'enclosure'}->{'type'} eq 'audio/mp3' ||
$_->{'enclosure'}->{'type'} eq 'audio/mpeg') {
print " ", aPlayer($_->{'enclosure'}->{'url'});
}
}
my $dump = param('dump');
if ($dump) {
my $x = Dumper($_);
#$x =~ s/</g;
#$x =~ s/>/>/g;
#$x =~ s/&/&/g;
print "$c->{'title'}
\n";
my @i;
if (ref($c->{'item'}) eq 'HASH') {
@i = ( $c->{'item'} );
} else {
@i = @{$c->{'item'}}[0 .. 9];
}
foreach (@i) {
print "{'link'}\">$_->{'title'}
";
print "$x
";
}
}
print footer(), end_html;
} else {
print header(), start_html(),
start_form(-method=>'get'), "URL of RSS or Podcast: ",
textfield(-name => 'url'),
end_form, footer(),
end_html;
}
sub aPlayer {
my $x = '';
if ($gAud == 0) {
$x .= "";
}
$gAud++;
return "";
}
sub vPlayer {
my($u, $w, $h) = @_;
$w = $w || 320;
$h = $h || 200;
# for the controls
$h += 55;
my $x = '';
if ($gVid == 0) {
$x .= "";
}
$gVid++;
$x .= "