summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-05-25 14:15:22 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-05-25 14:15:22 (GMT)
commit2fbd4bc628b28c88a45026a1ec4a324ca2bda417 (patch)
tree83e7097247d1b6eae1e0c401b1f91a7d1b2e0eec
parent25acf325139cc0f7ce59406bc083258aa1e8bfee (diff)
make interface of fetch_parse_rss the same as fetch_parse_json from rhrdlibs
-rwxr-xr-xrhautoimport-btl6
-rwxr-xr-xrhautoimport-dn13
-rwxr-xr-xrhautoimport-nw6
-rwxr-xr-xrhautoimport-oi6
-rwxr-xr-xrhautoimport-ra6
-rwxr-xr-xrhautoimport-rs6
-rwxr-xr-xrhautoimport-tr6
-rw-r--r--rhautoimport.pm6
-rwxr-xr-xtest/cba-inspect6
-rwxr-xr-xtest/rss-inspect6
10 files changed, 34 insertions, 33 deletions
diff --git a/rhautoimport-btl b/rhautoimport-btl
index 300027c..2144053 100755
--- a/rhautoimport-btl
+++ b/rhautoimport-btl
@@ -91,9 +91,9 @@ my $bdfile = sprintf("%02d%02d%02d-btlv128\.mp3", $broadcast_date[0]%100, $broad
print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport-dn b/rhautoimport-dn
index 80ffec3..b843e84 100755
--- a/rhautoimport-dn
+++ b/rhautoimport-dn
@@ -94,9 +94,9 @@ my $yc = sprintf("%04d-%02d%02d", @broadcast_day);
print "looking for files from date $y in RSS Feed\n";
print " -> $FILES_RSS_URL\n";
-my ($files_feed, $errstr) = rhautoimport::fetch_parse_rss($FILES_RSS_URL);
-unless (defined $files_feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $files_feed) = rhautoimport::fetch_parse_rss($FILES_RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $files_feed\n";
exit 1;
}
@@ -142,9 +142,10 @@ if($uri eq "") {
print "\nlooking for headlines from date $y in RSS Feed\n";
print " -> $HEADLINES_RSS_URL\n";
-(my $headlines_feed, $errstr) = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL);
-unless (defined $headlines_feed) {
- print "Error fetching feed: $errstr\n";
+
+my ($result, $headlines_feed) = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $headlines_feed\n";
exit 1;
}
diff --git a/rhautoimport-nw b/rhautoimport-nw
index 24350a9..697b003 100755
--- a/rhautoimport-nw
+++ b/rhautoimport-nw
@@ -84,9 +84,9 @@ my $bdfile = sprintf("NETWATCHER[-_]?%04d%02d%02d(.*)\.MP3", @broadcast_day);
print "looking for files from $bd in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport-oi b/rhautoimport-oi
index 40b9059..0f5b9b4 100755
--- a/rhautoimport-oi
+++ b/rhautoimport-oi
@@ -97,9 +97,9 @@ if($current_id eq $id) {
print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport-ra b/rhautoimport-ra
index 2464614..3544d10 100755
--- a/rhautoimport-ra
+++ b/rhautoimport-ra
@@ -82,9 +82,9 @@ my $bd = sprintf("%04d-%02d-%02d", @broadcast_day);
print "looking for files from $bd in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport-rs b/rhautoimport-rs
index e33a955..fbcae5e 100755
--- a/rhautoimport-rs
+++ b/rhautoimport-rs
@@ -129,9 +129,9 @@ my $bdfile = sprintf("RAST%04d%02d%02d(CBA)?(.*)\.MP3", @broadcast_date);
print "looking for files from $bd in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport-tr b/rhautoimport-tr
index df848a5..7b88c6d 100755
--- a/rhautoimport-tr
+++ b/rhautoimport-tr
@@ -84,9 +84,9 @@ my $bdfile = sprintf("^%04d-?%02d-?%02d", @broadcast_day);
print "looking for files from $bd in RSS Feed\n";
print " -> $RSS_URL\n";
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/rhautoimport.pm b/rhautoimport.pm
index c9f577c..4ea0808 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -68,12 +68,12 @@ sub fetch_parse_rss
$ua->agent($ua_str);
$ua->env_proxy;
my $res = URI::Fetch->fetch($uri, UserAgent => $ua);
- return (undef, URI::Fetch->errstr) unless $res;
- return (undef, "This feed has been permanently removed") if $res->status == URI::Fetch::URI_GONE();
+ return (0, URI::Fetch->errstr) unless $res;
+ return (0, "This feed has been permanently removed") if $res->status == URI::Fetch::URI_GONE();
my $xml = $res->content;
- return XML::Feed->parse(\$xml);
+ return (1, XML::Feed->parse(\$xml));
}
sub check_file_extension
diff --git a/test/cba-inspect b/test/cba-inspect
index b8546bd..f998d43 100755
--- a/test/cba-inspect
+++ b/test/cba-inspect
@@ -49,9 +49,9 @@ binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}
diff --git a/test/rss-inspect b/test/rss-inspect
index 3494e7c..1859ed7 100755
--- a/test/rss-inspect
+++ b/test/rss-inspect
@@ -49,9 +49,9 @@ binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
-my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL);
-unless (defined $feed) {
- print "Error fetching feed: $errstr\n";
+my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
+unless ($result) {
+ print "Error fetching feed: $feed\n";
exit 1;
}