Thread: IMDB Mod
View Single Post
  #1  
Old 26th January 2008, 20:12
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 984
Exclamation IMDB Mod
MOD UPDATED 18.09.2008

Uploader fills in torrent URL with correct imdb link. Then when people look at torrent details imdb info appears. If uploader fills something else then nothing happens. The class have cache, so only the first time data is grabbed, then its local.


REQUIREMENTS:

PHP-PEAR - go to imdb folder and edit imdb_config.php . There is a value for pear set to false.
Or install pear!

First you will need this php class :
http://projects.izzysoft.de/progs/imdbphp/files.php

Make a directory called imdb into the main (root) dir of your tracker
Extract the archive there.

Open details.php and below:
Code:
require_once("include/bittorrent.php");
ad this:
Code:
require ("imdb/imdb.class.php");
Edit imdb_config.class.php in the imdb folder with the correct parameters!!!
In the extracted files there is a imdb_config.php file, you have to edit it to match your files path


Open details.php and after:
PHP Code:
if (!empty($row["poster"]))
               
tr("Poster""<img src='".$row["poster"]."'>"1); 
Add this:
PHP Code:
//auto imdb mod
if (($row["url"] != "")AND(strpos($row["url"], imdb))AND(strpos($row["url"], title)))
{
$thenumbers ltrim(strrchr($row["url"],'tt'),'tt');
$thenumbers ereg_replace("[^A-Za-z0-9]"""$thenumbers);
$movie = new imdb ($thenumbers);
$movieid $thenumbers;
$movie->setid ($movieid);
$country $movie->country ();
$director $movie->director();
$write $movie->writing();
$produce $movie->producer();
$cast $movie->cast();
$plot $movie->plot ();
$compose $movie->composer();
$gen $movie->genres();
$plotoutline $movie->plotoutline();
$trailers $movie->trailers();
$mvlang $movie->language();
$mvrating $movie->rating();

if ((
$photo_url $movie->photo_localurl() ) != FALSE) {
$smallth '<img src="'.$photo_url.'">';
}

$autodata "<strong><font color=\"navy\">#######################################################################</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">Information:</font><br />\n";
$autodata .= "<font color=\"navy\">#######################################################################</font></strong><br />\n";
$autodata .= "<strong><font color=\"DarkRed\"> Title: </font></strong>" "".$movie->title()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\"> Year: </font></strong>" "".$movie->year()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\"> Runtime: </font></strong>" "".$movie->runtime()."" " mins<br />\n";
$autodata .= "<strong><font color=\"DarkRed\"> Votes: </font></strong>" "".$movie->votes()."<br />\n";

if (!empty(
$mvrating)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Rating: </font></strong>" "$mvrating<br />\n";
}

if (!empty(
$mvlang)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Language: </font></strong>" "$mvlang<br />\n";
}

if (!empty(
$country)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Country: </font></strong>";
    for (
$i 0$i count ($country); $i++) {
        
$autodata .="$country[$i], ";
    }
    
$autodata .= "$country[$i]<br />\n";
}

if (!empty(
$gen)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> All Genres: </font></strong>";
    for (
$i 0$i count($gen); $i++) {
        
$autodata .= "$gen[$i], ";
    }
    
$autodata .= "$gen[$i]<br />\n";
}

if (!empty(
$plotoutline)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Plot Outline: </font></strong>" "$plotoutline<br />\n";
}

if (!empty(
$director)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Director: </font></strong>";
    for (
$i 0$i count ($director); $i++) {
        
$autodata .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" "".$director[$i]["imdb"]."" ."\">" "".$director[$i]["name"]."" "</a><br />\n";
    }
}

if (!empty(
$write)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Writing By: </font></strong>";
    for (
$i 0$i count ($write); $i++) {
        
$autodata .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" "".$write[$i]["imdb"]."" ."\">" "".$write[$i]["name"]."" "</a> ";
    }
}

if (!empty(
$produce)) {
    
$autodata .= "<br />\n<strong><font color=\"DarkRed\"> Produced By: </font></strong>";
    for (
$i 0$i count ($produce); $i++) {
        
$autodata .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" "".$produce[$i]["imdb"]."" ." \">" "".$produce[$i]["name"]."" "</a> ";
    }    
}

if (!empty(
$compose)) {
    
$autodata .= "<br />\n<strong><font color=\"DarkRed\"> Music: </font></strong>";
    for (
$i 0$i count($compose); $i++) {
        
$autodata .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" "".$compose[$i]["imdb"]."" ." \">" "".$compose[$i]["name"]."" "</a> ";
    }
}

if (!empty(
$plot)) {
    
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">#######################################################################</font><br />\n";
    
$autodata .= "<font color=\"darkred\" size=\"3\"> Description:</font><br />\n";
    
$autodata .= "<font color=\"navy\">#######################################################################</font></strong>";
    for (
$i 0$i count ($plot); $i++) {
        
$autodata .= "<br />\n<font color=\"DarkRed\">•</font> ";
        
$autodata .= "$plot[$i]";
    }
}

$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">#######################################################################</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\"> Cast:</font><br />\n";
$autodata .= "<font color=\"navy\">#######################################################################</font></strong><br />\n";

for (
$i 0$i count ($cast); $i++) {
    if (
$i 9) {
        break;
    }
$autodata .= "<font color=\"DarkRed\">•</font> " "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" "".$cast[$i]["imdb"]."" ."\">" "".$cast[$i]["name"]."" "</a> " " as <strong><font color=\"DarkRed\">" "".$cast[$i]["role"]."" " </font></strong><br />\n";
}

if (!empty(
$trailers)) {
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">#######################################################################</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\"> Trailers:</font><br />\n";
$autodata .= "<font color=\"navy\">#######################################################################</font></strong><br />\n";

    for (
$i=0;$i<count($trailers);++$i) {
    if (
$i 14) {
        break;
    }
      
$autodata .= "<a target=\"_blank\" href='".$trailers[$i]."'>".$trailers[$i]."</a><br />\n";
    }
    }
trala("Auto IMDB Info $smallth",$autodata,1);
}
//end auto imdb 
Then in bittorrent.php under:
PHP Code:
function tr($x,$y,$noesc=0) {
    if (
$noesc)
        
$a $y;
    else {
        
$a htmlspecialchars($y);
        
$a str_replace("\n""<br />\n"$a);


    }

    print(
"<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n");

add:
PHP Code:
function trala($x,$y,$noesc=0) {
   if (
$noesc)
       
$a $y;
   print(
"<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n");

10x @ MaSTeRMinD - TBDEV.net
Reply With Quote
The Following 3 Users Say Thank You to Fynnon For This Useful Post:
josoo (20th December 2008), nicukent (2nd February 2014), sammygo (22nd May 2009)