Podcast-ESLPodcast-Splitter
view release on metacpan or search on metacpan
lib/Podcast/ESLPodcast/Splitter.pm view on Meta::CPAN
$$mp3_file, { verbose => 1 },
$durations->{start}, $durations->{explanation},
$durations->{fast}
);
return 1;
}
# download a mp3 file
sub download_mp3 {
my ( $uri, $mp3_file ) = @_;
open( my $fh, '>', $$mp3_file ) or die "$$mp3_file: $!";
my $res = LWP::UserAgent->new->get(
$$uri,
':content_cb' => sub {
my ( $chunk, $res, $proto ) = @_;
print $fh $chunk;
my $size = tell $fh;
if ( my $total = $res->header('Content-Length') ) {
printf "%d/%d (%f%%)\r", $size, $total, $size / $total * 100;
}
else {
printf "%d/Unknown bytes\r", $size;
}
}
);
close $fh;
print "\n", $res->status_line, "\n";
unlink $$mp3_file if ( !$res->is_success );
return $res->is_success;
}
1; # Magic true value required at end of module
__END__
=head1 NAME
Podcast::ESLPodcast::Splitter - Split ESLPodcast into fast, slow and explanation dialogs.
=head1 VERSION
This document describes Podcast::ESLPodcast::Splitter version 0.0.1
=head1 SYNOPSIS
use Podcast::ESLPodcast::Splitter;
$splitter = Podcast::ESLPodcast::Splitter->new;
$splitter->run();
=head1 DESCRIPTION
The "Podcast::ESLPodcast::Splitter" is a class to split a ESLPodcast mp3 file
into 3 dialogs, fast, slow and explanation dialogs.
You can listen to these dialogs as you like.
This module works as follows.
1. fetch a XML feed for the ESLPodcast.
2. parse XML and extract duration information and mp3 file URIs.
3. split mp3 files according to the duration information.
=head1 INTERFACE
$splitter->run
do mentioned above
=head1 DIAGNOSTICS
"skip: English Cafe"
skip because an English Cafe mp3 files cannot be splitted.
"download failure"
cannot dowload a mp3 file.
"split failure"
cannot split a downloaded mp3 file.
=over
=item C<< Error message here, perhaps with %s placeholders >>
[Description of error here]
=item C<< Another error message here >>
[Description of error here]
[Et cetera, et cetera]
=back
=head1 CONFIGURATION AND ENVIRONMENT
Podcast::ESLPodcast::Splitter requires no configuration files or environment variables.
=head1 DEPENDENCIES
None.
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-podcast-eslpodcast-splitter@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
( run in 1.217 second using v1.01-cache-2.11-cpan-71847e10f99 )