Changeset 383

Show
Ignore:
Timestamp:
05/10/10 20:27:11 (4 months ago)
Author:
izzy
Message:

! imdb site changes broke imdb::releaseInfo() again (see ticket:144; backport from trunk)

Location:
branches/php4-imdbonly
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/php4-imdbonly/doc/CHANGELOG

    r379 r383  
    77------------------- 
    88! imdb::tagline() and imdb::prodNotes() have been affected by some site changes (backport from trunk) 
     9! imdb site changes broke imdb::releaseInfo() again 
    910 
    1011v1.2.5 (26.04.2010) 
  • branches/php4-imdbonly/imdb.class.php

    r378 r383  
    12581258      $tag_e = strpos($this->page["ReleaseInfo"],'</table',$tag_s); 
    12591259      $block = substr($this->page["ReleaseInfo"],$tag_s,$tag_e-$tag_s); 
    1260       preg_match_all('!<tr><td><b><a href="/Recent/(.*?)</td></tr>!ims',$block,$matches); 
     1260      preg_match_all('!<tr><td><b>(.*?)</b></td>\s*<td[^>]*>(.*?)</td>\s*<td>(.*?)</td>!ims',$block,$matches); 
    12611261      $mc = count($matches[0]); 
    12621262      for ($i=0;$i<$mc;++$i) { 
    1263         $date = '!!'; 
    1264         if ( preg_match('/.*?">(.*?)<.*?<td.*?href=.*\/date\/(\d+)-(\d+).*">\d+\s*(.*?)<.*?>(\d{4})<.*?<td>\s*(\((.*?)\)\s*|)$/ims',$matches[1][$i],$match) ) { 
    1265           $this->release_info[] = array("country"=>$match[1],"day"=>$match[3],"month"=>$match[4],"mon"=>$match[2],"year"=>$match[5],"comment"=>$match[7]); 
    1266         } elseif ( preg_match('!>(.*?)</a>\s*</b></td>\s*<td align="right">\s*([A-Za-z]+)\s*(\d{4})\s*</td>\s*<td>(\((.*?)\)|\s*)$!ims',$matches[1][$i],$match) ) { 
    1267           if ( empty($match[5]) ) $this->release_info[] = array("country"=>$match[1],"day"=>"","month"=>$match[2],"mon"=>$this->monthNo($match[2]),"year"=>$match[3],"comment"=>""); 
    1268           else $this->release_info[] = array("country"=>$match[1],"day"=>"","month"=>$match[2],"mon"=>$this->monthNo($match[2]),"year"=>$match[3],"comment"=>$match[5]); 
    1269         } elseif ( preg_match('|.*?">(.*?)</a>\s*</b></td>\s*<td align="right">\s(\d{4})</td>\s*(<td>\s*(.*))|ims',$matches[1][$i],$match) ) { // unlinked data, year only plus comment 
    1270           if ( empty($match[3]) ) $this->release_info[] = array("country"=>$match[1],"day"=>"","month"=>"","mon"=>'',"year"=>$match[2],"comment"=>""); 
    1271           $this->release_info[] = array("country"=>$match[1],"day"=>"","month"=>"","mon"=>'',"year"=>$match[2],"comment"=>$match[4]); 
    1272         } elseif ( preg_match('|">(.*?)<.*?">\s*(\D*)\s*(\d+)<.*<td>(.*)|ims',$matches[1][$i],$match) ) { 
    1273           $this->release_info[] = array("country"=>$match[1],"day"=>'',"month"=>trim($match[2]),"mon"=>$this->monthNo(trim($match[2])),"year"=>$match[3],"comment"=>$match[4]); 
     1263        $country = $matches[1][$i]; 
     1264        if ( preg_match('!href="/date/(\d{2})-(\d{2})/">\d+ (.*?)</a>\s*<a href="/year/(\d{4})/">!is',$matches[2][$i],$match) ) { // full info 
     1265          $this->release_info[] = array('country'=>$country,'day'=>$match[2],'month'=>$match[3],'mon'=>$match[1],'year'=>$match[4],'comment'=>$matches[3][$i]); 
     1266        } elseif ( !preg_match('|a href=|i',$matches[2][$i],$match) ) { // no links within 
     1267          if ( preg_match('!^(.+?)\s(\d{4})$!s',trim($matches[2][$i]),$match) ) { // month and year 
     1268            $this->release_info[] = array('country'=>$country,'day'=>'','month'=>$match[1],'mon'=>$this->monthNo(trim($match[1])),'year'=>$match[2],'comment'=>$matches[3][$i]); 
     1269          } elseif ( preg_match('!(\d{4})!',trim($matches[2][$i]),$match) ) { // year at least 
     1270            $this->release_info[] = array('country'=>$country,'day'=>'','month'=>'','mon'=>'','year'=>$match[1],'comment'=>$matches[3][$i]); 
     1271          } 
    12741272        } else { 
    1275           $this->debug_scalar("NO MATCH ON<pre>".htmlentities($matches[1][$i])."</pre>"); 
     1273          $this->debug_scalar("NO MATCH ON<pre>".htmlentities($matches[2][$i])."</pre>"); 
    12761274        } 
    12771275      }