From 942e6fac0ae6ac250e8562d6d3d54fc06fa65621 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Fri, 3 Jun 2016 18:32:14 +0200
Subject: fixed EU importer (already downloaded file...)


diff --git a/rhautoimport-eu b/rhautoimport-eu
index a8a57aa..5aad6f0 100755
--- a/rhautoimport-eu
+++ b/rhautoimport-eu
@@ -27,7 +27,6 @@ use DateTime::Format::ISO8601;
 use URI::URL;
 use HTML::Entities;
 
-use lib '../rhrdlibs/lib';
 use lib '/usr/local/share/rhautoimport/';
 use rhautoimport;
 
@@ -101,10 +100,7 @@ my $file = "";
 my $sum_title = "";
 my $sum_text = "";
 
-my $i = 0;
 for my $clip (@clips) {
-  $i++;
-
   $sum_title = decode_entities($clip->{title});
   next unless $sum_title =~ /$titleexp/;
 
@@ -128,6 +124,16 @@ for my $clip (@clips) {
   my @path = $uri->path_components;
   $file = $path[-1];
 
+  my $current_file = `cat $STAT_FILE`;
+  if($current_file eq $file) {
+    print "Already downloaded file of today\n";
+    exit 42;
+  }
+  if(!rhautoimport::check_file_extension($file)) {
+    print "\n\nThe extension of the matching file '". $file . "' seems to be wrong - manual import necessary!!!\n";
+    exit 1;
+  }
+
   last
 }
 if($uri eq "") {
-- 
cgit v0.10.2