diff options
Diffstat (limited to 'rhimport-fl')
-rwxr-xr-x | rhimport-fl | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rhimport-fl b/rhimport-fl index 52fbc3b..f7928ef 100755 --- a/rhimport-fl +++ b/rhimport-fl @@ -119,8 +119,8 @@ my $feed = rhimport::fetch_parse_rss($RSS_URL) or die "Error fetching feed: " . XML::Feed->errstr; my $shows_left = -1; -my $file = ""; my $out_file = ""; +my $url = ""; my $this_broadcast = $last_broadcast; my $i = 0; for my $entry ($feed->entries) { @@ -145,7 +145,7 @@ for my $entry ($feed->entries) { $fetchurl = $1 . $2; } - my $url = new URI::URL($fetchurl); + $url = new URI::URL($fetchurl); my @path = $url->path_components; $out_file = $path[-1]; if(!rhimport::check_file_extension($out_file)) { @@ -154,21 +154,22 @@ for my $entry ($feed->entries) { exit 1; } - print " --> #" . $idt . ": downloading " . $url . " (" . $enclosure->length . " Bytes) .. "; - $file = "/tmp/" . $out_file; - system("wget", "--quiet", "--no-check-certificate", $url, "-O", $file); - if( $! != 0) { - die "wget returned with error: " . $!; - } - print "ok\n"; - $this_broadcast = $idt; last; } } } +print " --> #" . $this_broadcast . ": downloading " . $url . " .. "; +my $file = "/tmp/" . $out_file; +system("wget", "--quiet", "--no-check-certificate", $url, "-O", $file); +if( $! != 0) { + die "wget returned with error: " . $!; +} +print "ok\n"; + + if($file eq "" || !(-e "$file")) { - print "No Entry for $last_broadcast (there are no new shows available) - "; + print "No Entry for $last_broadcast (there are no new shows available) or download error - "; if($LAST_RUN) { print "giving up, manual import necessary!!!\n"; } else { |