All pastes #352361 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-12 19:45 UTC
rendered paste body
#!/usr/bin/perl

use XML::Simple;
use LWP::Simple;

$xml = new XML::Simple;
$noext = "/tmp/newscnn";
$resampled = "/tmp/newscnn.mp3";

debug("Getting XML file", 1);
$data = $xml->XMLin(get("http://www.cnn.com/services/podcasting/newscast/rss.xml"));
$url = $data->{channel}->{item}->[0]->{link};
debug("Extracted URL '$url' from XML file", 1);
$url =~ m#(?:.*/)(.*)$#;
$podcast = "/tmp/" . $1;
if ((-s $podcast) && (-s $resampled))
{
debug("'$podcast' already exists - skipping download", 1);
}
else
{
system("rm /tmp/newscnn*.mp3");
debug("Getting '$url', 1);
getstore("$url", "$podcast") or die "Could not retrieve podcast";
debug("'$podcast' retrived", 1);
system("lame --silent --mp3input --scale 5 --abr 32 -m m -h $podcast $resampled")==0 or die "Could not convert file";
debug("'$pd' converted to '$resampled'", 1);
}
exit;