FIX adaptation au site Allocine.
[pompage.git] / src / modules / allocine.rb
index b4b65f0..aa35cb1 100644 (file)
@@ -20,7 +20,7 @@ module Net
    end\r
 end\r
 \r
-# un module d'importation pour le site "www.allocine.fr"\r
+# Un module d'importation pour le site "www.allocine.fr".\r
 class Allocine  < Basemodule\r
    \r
    def createConnexion\r
@@ -37,7 +37,7 @@ class Allocine  < Basemodule
       @connexion = nil\r
    end\r
    \r
-   # voir le parent.\r
+   # Voir le parent.\r
    def rechercherFilm(titre)\r
       createConnexion\r
       \r
@@ -68,7 +68,7 @@ class Allocine  < Basemodule
       \r
       reponses = {}\r
       unless titre.nil? or titre.empty?\r
-         r = html.scan(/<a href="\/film\/fichefilm_gen_cfilm=(\d+)\.html" class="link1">(.*?)<\/a>(?:<\/h4><h5 style="color: #666666">&nbsp;(.*?)<\/h5>){0,1}(?:<h4><br \/><\/h4>){0,1}(?:<h4 style="color: #666666"> de (.*?)<\/h4>){0,1}(?:<h4 style="color: #666666">&nbsp;avec (.*?)<\/h4>){0,1}(?:<h4 style="color: #666666">&nbsp;\((.*?)\)<\/h4>){0,1}/)\r
+         r = html.scan(/<a href="\/film\/fichefilm_gen_cfilm=(\d+)\.html" class="link1">(.*?)<\/a>(?:<\/h4><h5 style="color: #666666">&nbsp;(.*?)<\/h5>)?(?:<h4 style="color: #666666"><br \/>de (.*?)<\/h4>)?(?:<h4 style="color: #666666"><br \/>avec (.*?)<\/h4>)?(?:<h4 style="color: #666666">&nbsp;\((.*?)\)<\/h4>)?/)\r
 \r
          r.each{|f|\r
             reponses[f[1].virerBalisesHTML + (f[2] != nil ? " " + f[2].virerBalisesHTML : "") + (f[3] != nil ? " de " + f[3].virerBalisesHTML : "") + (f[4] != nil ? " avec " + f[4].virerBalisesHTML : "") + (f[5] != nil ? " (" + f[5].virerBalisesHTML + ")" : "")] = f[0]\r
@@ -82,11 +82,11 @@ class Allocine  < Basemodule
       loadPath("/film/fichefilm_gen_cfilm=#{id}.html", film)\r
    end\r
    \r
+   # Voir le parent.\r
    def loadURL(url, film)\r
       loadPath(URI.parse(url).path, film)\r
    end\r
    \r
-   # Voir le parent.\r
    def loadPath(path, film)\r
       createConnexion\r
 \r
@@ -103,9 +103,10 @@ class Allocine  < Basemodule
       \r
       puts "Pompage de #{film.titre} (#{film.fichiers[0]}) ..."\r
       \r
-      #convertit le code latin-1 en UTF8      \r
+      # convertit le code latin-1 en UTF8      \r
       html = Iconv.iconv("UTF-8", "ISO-8859-1", html)[0]\r
             \r
+      # pompage de l'image dans un thread séparé\r
       if take?("image") && ($force || !film.possedeImage?)\r
          /<img src="(.*?)" border="0" alt="" class="affichette" \/>/ =~ html\r
          unless $1.nil?\r
@@ -212,9 +213,10 @@ class Allocine  < Basemodule
       end\r
       \r
       fermerConnexion\r
-   end   \r
+   end\r
    \r
    def finish\r
+      # on attend que tous les threads de pompage d'image aient terminé\r
       @threadImage.join if defined? @threadImage\r
    end\r
 end
\ No newline at end of file