diff options
Diffstat (limited to 'rhautoimport-dn')
-rwxr-xr-x | rhautoimport-dn | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/rhautoimport-dn b/rhautoimport-dn index 4cf7eb0..0feafdb 100755 --- a/rhautoimport-dn +++ b/rhautoimport-dn @@ -93,6 +93,9 @@ my $files_feed = rhautoimport::fetch_parse_rss($FILES_RSS_URL) my $uri = ""; my $file = ""; +my $sum_title = ""; +my $sum_text = ""; + for my $entry ($files_feed->entries) { if($entry->enclosure && $entry->enclosure->type eq "audio/mpeg") { if($entry->enclosure->url =~ /^https?:\/\/.*\.democracynow\.org\/dn([0-9-]+)-1\.mp3$/) { @@ -117,7 +120,7 @@ for my $entry ($files_feed->entries) { } } if($uri eq "") { - print "No Entry found from day in question or download error - "; + print "No Entry found from day in question - "; if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "giving up, manual import necessary!!!\n"; } else { @@ -135,30 +138,32 @@ my $headlines_feed = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL) for my $entry ($headlines_feed->entries) { if($entry->enclosure && $entry->enclosure->type eq "audio/mpeg") { - my $sum_title = $entry->title; - my $sum_text = $entry->summary->body . "\n<br />\n<a href=\"" . $entry->link . "\">" . $entry->link . "</a>\n"; + $sum_title = $entry->title; + $sum_text = $entry->summary->body . "\n<br />\n<a href=\"" . $entry->link . "\">" . $entry->link . "</a>\n"; if($entry->id =~ /tag:democracynow.org,([0-9-]+):media\/mp3podcast\/[^\/]+/) { next if($y ne $1); print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n"; - rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1", 0); - last; } } } -print "will import '$uri' to show $show_id, $show_title\n\n"; +print "\n\nwill import '$uri' to show $show_id, $show_title\n\n"; my ($ret, $log) = rhautoimport::import_uri($show_id, $uri->as_string); if($ret) { print "\nImport Error:\n\n"; print $log; + print "\n\nNot adding PV note!!"; exit 1; } print "\nImport Success:\n\n"; print $log; +if($sum_title ne "") { + rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1", 0); +} unlink($STAT_FILE); open(my $fhs, '>', $STAT_FILE); |