X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;ds=inline;f=src%2Fmodules%2Fallocine.rb;fp=src%2Fmodules%2Fallocine.rb;h=9c0cbffdeb04f3e914e9a0db31f802e2342cef10;hb=339621e8669fbd4b09e2d0825f5521469503837b;hp=5a4e759a51646b1902ca5d55b125bfd26a3edf2b;hpb=3c0d34648b6522fcd86baa485bf6008ba805f7a3;p=pompage.git
diff --git a/src/modules/allocine.rb b/src/modules/allocine.rb
index 5a4e759..9c0cbff 100644
--- a/src/modules/allocine.rb
+++ b/src/modules/allocine.rb
@@ -79,7 +79,7 @@ class Allocine < Basemodule
# Voir le parent.
def load(id, film)
- loadPath("/film/fichefilm_gen_cfilm=#{id}.html")
+ loadPath("/film/fichefilm_gen_cfilm=#{id}.html", film)
end
def loadURL(url, film)
@@ -105,8 +105,8 @@ class Allocine < Basemodule
#convertit le code latin-1 en UTF8
html = Iconv.iconv("UTF-8", "ISO-8859-1", html)[0]
-
- if take?("image")
+
+ if take?("image") && ($force || !film.possedeImage?)
// =~ html
unless $1.nil?
@threadImage = Thread::start($1){|imageUrl|
@@ -114,10 +114,7 @@ class Allocine < Basemodule
begin
imageUrlParsed = URI.parse(imageUrl)
connexionImage = Net::HTTP::new(imageUrlParsed.host).start
- image = connexionImage.get(imageUrlParsed.path).body
- f = File::new($repBase + "/" + $repAffichette + film.id.to_s + ".jpg", 'w').binmode
- f.write(image)
- f.close
+ film.setImage(connexionImage.get(imageUrlParsed.path).body)
connexionImage.finish
rescue Exception => e
puts e.message
@@ -129,24 +126,24 @@ class Allocine < Basemodule
end
end
- #url
- if take?("url")
+ if take?("url") && ($force || film.url == nil)
+ #url
film.url = "http://www.allocine.fr" + path
end
- if take?("titre")
+ if take?("titre") && ($force || film.titre == '')
# Titre
/