From 593cb6b5edc8adfe2bbf290ba594f9260c0cf350 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 12 Mar 2016 23:50:05 +0100 Subject: btl is now tested as well - note will only be set when import was successful diff --git a/rhautoimport-btl b/rhautoimport-btl index eb05594..38d3090 100755 --- a/rhautoimport-btl +++ b/rhautoimport-btl @@ -83,6 +83,9 @@ my $feed = rhautoimport::fetch_parse_rss($RSS_URL) my $uri = ""; my $file = ""; +my $sum_title = ""; +my $sum_text = ""; + for my $entry ($feed->entries) { if($entry->enclosure && ($entry->enclosure->type eq "audio/mpeg" || entry->enclosure->type eq "audio/mp3")) { next unless $entry->enclosure->url =~ /$bdfile/; @@ -101,17 +104,15 @@ for my $entry ($feed->entries) { exit 1; } - my $sum_title = decode_entities($entry->title); + $sum_title = decode_entities($entry->title); $sum_title =~ s/ \(128 kbps\)$//; - my $sum_text = decode_entities($entry->content->body); + $sum_text = decode_entities($entry->content->body); print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n"; - rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1"); - last; } } if($uri eq "") { - print "No Entry found for " . Date::Calc::Date_to_Text(@broadcast_date) . " or download error - "; + print "No Entry found for " . Date::Calc::Date_to_Text(@broadcast_date) . " - "; if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "giving up, manual import necessary!!!\n"; } else { @@ -120,16 +121,18 @@ if($uri eq "") { exit 1; } -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; +rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1"); unlink($STAT_FILE); open(my $fhs, '>', $STAT_FILE); diff --git a/rhautoimport-ra b/rhautoimport-ra index 3cf2843..d75d18e 100755 --- a/rhautoimport-ra +++ b/rhautoimport-ra @@ -136,7 +136,7 @@ if($uri eq "") { exit 1; } -print "will import '$uri' to show $show_id, $show_title\n"; +print "\n\nwill import '$uri' to show $show_id, $show_title\n"; my ($ret, $log, $keptfile_uri) = rhautoimport::import_uri($show_id, $uri->as_string, "keep"); if($ret == 0) { print "\nImport Success:\n\n"; @@ -159,11 +159,13 @@ if($ret == 0) { } else { print "\nImport Error:\n\n"; print $log; + print "\n\nNot adding PV note!!"; exit 1; } } else { print "\nImport Error:\n\n"; print $log; + print "\n\nNot adding PV note!!"; exit 1; } -- cgit v0.10.2