X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2Fmodules%2Fallocine.rb;h=c26c214d0e85ef5e65eb9510965cef5d53a1d916;hb=171308744ae16e63958d4b83dc135aa7bbdeab8f;hp=9c0cbffdeb04f3e914e9a0db31f802e2342cef10;hpb=339621e8669fbd4b09e2d0825f5521469503837b;p=pompage.git diff --git a/src/modules/allocine.rb b/src/modules/allocine.rb index 9c0cbff..c26c214 100644 --- a/src/modules/allocine.rb +++ b/src/modules/allocine.rb @@ -20,7 +20,7 @@ module Net end end -# un module d'importation pour le site "www.allocine.fr" +# Un module d'importation pour le site "www.allocine.fr". class Allocine < Basemodule def createConnexion @@ -37,7 +37,7 @@ class Allocine < Basemodule @connexion = nil end - # voir le parent. + # Voir le parent. def rechercherFilm(titre) createConnexion @@ -82,11 +82,11 @@ class Allocine < Basemodule loadPath("/film/fichefilm_gen_cfilm=#{id}.html", film) end + # Voir le parent. def loadURL(url, film) loadPath(URI.parse(url).path, film) end - # Voir le parent. def loadPath(path, film) createConnexion @@ -103,9 +103,10 @@ class Allocine < Basemodule puts "Pompage de #{film.titre} (#{film.fichiers[0]}) ..." - #convertit le code latin-1 en UTF8 + # convertit le code latin-1 en UTF8 html = Iconv.iconv("UTF-8", "ISO-8859-1", html)[0] + # pompage de l'image dans un thread séparé if take?("image") && ($force || !film.possedeImage?) // =~ html unless $1.nil? @@ -131,10 +132,10 @@ class Allocine < Basemodule film.url = "http://www.allocine.fr" + path end - if take?("titre") && ($force || film.titre == '') + if take?("titre") # Titre /(.*?)<\/title>/ =~ html - film.titre = $1 unless $1.nil? + film.titre = $1 end if take?("annee") && ($force || film.annee == nil) @@ -212,9 +213,10 @@ class Allocine < Basemodule end fermerConnexion - end + end def finish + # on attend que tous les threads de pompage d'image aient terminé @threadImage.join if defined? @threadImage end end \ No newline at end of file