Ticket #6231: allocine.pl.6231.patch

File allocine.pl.6231.patch, 2.6 KB (added by zorglups, 12 years ago)

patch to the allocine.pl v2.00 from Xavier Hervy

  • /usr/share/mythtv/mythvideo/scripts/allocine.pl

    old new  
    123123
    124124   # parse title and year
    125125   my $title = parseBetween($response, "<title>", "</title>");
    126    my $original_title = parseBetween($response, "<h4>Titre original : <i>","</i></h4></div>");
     126   # remove the "- Allocin.*" suffix
     127   $title =~ s{\s*-\s*AlloCin.*}{};
     128   my $original_title = parseBetween($response, ">Titre original : <i>","</i></h");
    127129   $original_title = removeTag($original_title);
    128130   if (defined $opt_originaltitle){
    129131      if ($original_title  ne  ""){
     
    133135   
    134136   #print "titre = $title\n";
    135137   $title = removeTag($title);
    136    my $year = parseBetween($response,"<h4>Année de production : ","</h4>");
     138   my $year = parseBetween($response,">Année de production : ","</h");
    137139
    138140   # parse director
    139    my $director = parseBetween($response,"<h4>Réalisé par ","</h4>");
     141   my $director = parseBetween($response,">Réalisé par ","</h");
    140142   $director = removeTag($director);
    141143
    142144   # parse writer
     
    182184   
    183185
    184186   # parse movie length
    185    my $runtime = parseBetween($response,"Durée : ",".&nbsp;</h4>");
     187   my $runtime = parseBetween($response,"Durée : ",".&nbsp;</h");
    186188   my $heure;
    187189   my $minutes;
    188190   ($heure,$minutes)=($runtime=~/[^\d]*(\d+)[^\d]*(\d*)/);
     
    198200
    199201   # parse cast
    200202
    201    my $cast = parseBetween($response, "<h4>Avec ","</h4>");
     203   my $cast = parseBetween($response, ">Avec ","</h");
    202204   $cast = removeTag($cast);
     205   $cast =~ s{\s*Plus...}{ ...};
    203206   if (defined $opt_casting){
    204207      my $responsecasting = get "http://www.allocine.fr/film/casting_gen_cfilm=" . $movieid . ".html";
    205208      my $fullcast = parseBetween($responsecasting, "Acteur(s)", "<table");
     
    219222   
    220223
    221224   #genres
    222    my $genres = parseBetween($response,"<h4>Genre : ","</h4>");
     225   my $genres = parseBetween($response,">Genre : ","</h");
    223226   $genres = removeTag($genres);
    224227   
    225228   #countries
    226    my $countries = parseBetween($response,"<h4>Film ",".&nbsp;</h4>");
     229   my $countries = parseBetween($response,">Film ",".&nbsp;</h");
    227230   $countries = removeTag($countries);
    228231
    229232   # output fields (these field names must match what MythVideo is looking for)
     
    375378           #
    376379           # don't try to invent if it doesn't exist
    377380           #
    378            return if $response =~ /Pas de résultats/;
     381           return if $response =~ /Pas de résultats|Recherche web sur AlloCiné/;
    379382       
    380383           # extract possible matches
    381384           #    possible matches are grouped in several catagories: