From 65b1d997960b1600d25878c78664d4d43e2b37c0 Mon Sep 17 00:00:00 2001 From: pifou Date: Thu, 5 Jul 2007 21:23:08 +0000 Subject: [PATCH] git-svn-id: svn://euphorik.ch/pompage@48 02bbb61a-6d21-0410-aba0-cb053bdfd66a --- src/modules/allocine.rb | 5 +++-- src/test.rb | 20 +++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/modules/allocine.rb b/src/modules/allocine.rb index 01764f8..7f232f2 100644 --- a/src/modules/allocine.rb +++ b/src/modules/allocine.rb @@ -91,6 +91,7 @@ class Allocine < Basemodule // =~ html unless $1.nil? @threadImage = Thread::start($1){|imageUrl| + nbRetry = 0 begin imageUrl = URI.parse(imageUrl) connexionImage = Net::HTTP::new(imageUrl.host).start @@ -102,8 +103,8 @@ class Allocine < Basemodule rescue Exception => e puts e.message puts e.backtrace - puts "[!] Erreur lors du chargement de l'image #{imageUrl}, retry.." - retry + puts "[!] Erreur lors du chargement de l'image '#{imageUrl}', retry.." + retry if (nbRetry += 1) < 5 end } end diff --git a/src/test.rb b/src/test.rb index e993005..9a4edba 100644 --- a/src/test.rb +++ b/src/test.rb @@ -1,14 +1,8 @@ +# coding: utf-8 +html = '
' +// =~ html +url = URI.parse($1) +p url.host -def pomper(r) - Dir::foreach(r){|f| - next if f[0,1] == '.' - fichier = (r == '.' ? '' : r + "/") + f - if File::directory?(fichier) - pomper(fichier) - else - p fichier - end - } -end - -pomper("F:\\films") \ No newline at end of file +nbRetry = 0 +p "youpla" if (nbRetry += 1) < 5 \ No newline at end of file -- 2.45.2