summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-12 23:50:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-12 23:50:14 (GMT)
commitb5c2b5dbabe04b0852e44a7fc526d1b748a2d7b5 (patch)
tree9f337adbbc26337e5dbfc592657c8e412e473530
parent5811d4baa233e24fa09cbf2bf0d398a2221d9e56 (diff)
radio stimme improved still not done - note will only be set when import was successful
-rwxr-xr-xrhautoimport-rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/rhautoimport-rs b/rhautoimport-rs
index 576f213..a409e19 100755
--- a/rhautoimport-rs
+++ b/rhautoimport-rs
@@ -29,6 +29,7 @@ use XML::Feed::Content;
use XML::Feed::Enclosure;
use URI::URL;
use HTML::Entities;
+use RHRD::utils;
use lib '/usr/local/share/rhautoimport/';
use rhautoimport;
@@ -116,6 +117,9 @@ my $feed = rhautoimport::fetch_parse_rss($RSS_URL)
my $uri = "";
my $file = "";
+my $sum_title = "";
+my $sum_text = "";
+
my $i = 0;
for my $entry ($feed->entries) {
$i++;
@@ -133,7 +137,10 @@ for my $entry ($feed->entries) {
$uri = new URI::URL($orig_uri);
my @path = $uri->path_components;
$file = $path[-1];
- next unless (uc($file) =~ $bdfile); # file not from correct day
+ unless(uc($file) =~ $bdfile) { # file not from correct day
+ $uri = "";
+ next;
+ }
my $current_stat = `cat $STAT_FILE`;
my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/;
@@ -146,18 +153,16 @@ for my $entry ($feed->entries) {
exit 1;
}
- my $sum_title = decode_entities($entry->title);
- my $sum_text = decode_entities($entry->content->body);
+ $sum_title = decode_entities($entry->title);
+ $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;
}
}
- last if $file ne "";
+ last if $uri ne "";
}
if($uri eq "") {
- print "No Entry found from $bd or download error - ";
+ print "No Entry found from $bd - ";
if($#ARGV >= 0 && $ARGV[0] eq 'last') {
print "giving up, manual import necessary!!!\n";
} else {
@@ -166,16 +171,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);