From 7e98159beb298a064878508e5e97fa2c060e4885 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Sun, 13 Mar 2016 00:26:00 +0100
Subject: netwatcher is now tested as well - note will only be set when import
 was successful


diff --git a/rhautoimport-nw b/rhautoimport-nw
index 4642707..2fbc9c8 100755
--- a/rhautoimport-nw
+++ b/rhautoimport-nw
@@ -83,6 +83,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++;
@@ -112,18 +115,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 "";
 }
 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 {
@@ -132,16 +133,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);
-- 
cgit v0.10.2