[Koha-cvs] koha/intranet/cgi-bin/classes class.imdb_parser... [rel_TG]

Tumer Garip tgarip at neu.edu.tr
Sat Mar 10 02:18:01 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_TG
Changes by:	Tumer Garip <tgarip1957>	07/03/10 01:18:01

Added files:
	intranet/cgi-bin/classes: class.imdb_parser.php 

Log message:
	fresh files for rel_TG

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/classes/class.imdb_parser.php?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1

Patches:
Index: class.imdb_parser.php
===================================================================
RCS file: class.imdb_parser.php
diff -N class.imdb_parser.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ class.imdb_parser.php	10 Mar 2007 01:18:01 -0000	1.1.2.1
@@ -0,0 +1,197 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+* class.imdb_parser.php (php4)
+* Parse information of any film - need a fetched imdb.com video-detail-site
+* @author       Bernd Essl <bernd at ak47.at>
+* @copyright    Bernd Essl <bernd at ak47.at>
+* @license      license   http://gnu.org/copyleft/gpl.html GNU GPL
+* @version      SVN: 4
+* @link         http://ak-47.at/
+*/
+
+
+class IMDB_Parser
+{
+
+    function getMovieActors($imdb_website)
+    {
+       if (preg_match('/<table class="cast">  <tr class="odd"><td class="hs">(.+)<\/tr><\/table><a class="tn15more" href="fullcredits#cast">more<\/a>/', $imdb_website, $hit))
+       {	
+            if (preg_match_all('/<a href="\/name\/nm\d{1,8}\/">(.+?)<\/a>/',$hit[0],$results, PREG_PATTERN_ORDER))
+            {
+                return $results[1];
+            }else
+            {
+                return FALSE;
+      	} 
+           
+     } else
+            {
+                return FALSE;
+      } 
+    }
+
+
+    function getMovieDirectedBy($imdb_website)
+    {
+        if (preg_match( '/<h5>Directed by<\/h5>\
+<a href="\/name\/nm\d{1,8}\/">(.+?)<\/a><br\/>/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieColor($imdb_website)
+    {
+        if (preg_match('/<a href="\/List\?color-info=.+">(.+)<\/a>/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieCountry($imdb_website)
+    {
+        if (preg_match_all('/<a href="\/Sections\/Countries\/([a-z]+)\/">/i',$imdb_website,$results, PREG_PATTERN_ORDER))
+        {
+            return $results[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieLanguage($imdb_website)
+    {
+        if (preg_match_all('/<a href="\/Sections\/Languages\/([a-z]+)\/">/i',$imdb_website,$results, PREG_PATTERN_ORDER))
+        {
+            return $results[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieRating($imdb_website)
+    {
+        if (preg_match('/<b>([0-9]{1,2}\.[0-9]{1,2})\/10<\/b> \(.+ votes\)/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieGenres($imdb_website)
+    {
+        if (preg_match_all('/\/Sections\/Genres\/(.+?)\//', $imdb_website, $hit, PREG_PATTERN_ORDER)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMoviePlot($imdb_website)
+    {
+    //sometimes "Plot Outline" or "Plot Summary"
+        if (preg_match('/\<h5\>Plot Outline:\<\/h5\>
+(.+?)\<a class="tn15more inline"/', $imdb_website, $hit)) 
+        {
+            return $hit['2'];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+ function getMovieSummary($imdb_website_summary)
+    {
+        if (preg_match_all('/\<p class="plotpar"\>\
+(.+)\
+\<i\>/', $imdb_website_summary, $hit, PREG_PATTERN_ORDER)) 
+        {
+          return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    function getMovieTagline($imdb_website)
+    {
+        if (preg_match('/\<h5\>Tagline:\<\/h5\>
+(.+?)\<a class="tn15more inline"/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMovieTitle($imdb_website)
+    {
+        if (preg_match('/\<title\>([^"]*)\<\/title\>/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    
+    
+    function getMoviePictureHtml($imdb_website)
+    {
+        if (preg_match('/<a name="poster".+title=".+">(.+)<\/a>/', $imdb_website, $hit)) 
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+
+
+    function getMoviePicture($imdb_website)
+    {
+        if (preg_match('/ src="([^"]*)/', $this->getMoviePictureHtml($imdb_website), $hit))
+        {
+            return $hit[1];
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+}  
+?>
\ No newline at end of file





More information about the Koha-cvs mailing list