Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   IMDB Mod (http://www.bvlist.com/showthread.php?t=139)

Fynnon 26th January 2008 20:12

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

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

if (!empty(
$mvlang)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Language: </font></strong>" "$mvlang\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]\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]\n";
}

if (!empty(
$plotoutline)) {
    
$autodata .= "<strong><font color=\"DarkRed\"> Plot Outline: </font></strong>" "$plotoutline\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>\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 .= "\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 .= "\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 .= "\n\n<strong><font color=\"navy\">#######################################################################</font>\n";
    
$autodata .= "<font color=\"darkred\" size=\"3\"> Description:</font>\n";
    
$autodata .= "<font color=\"navy\">#######################################################################</font></strong>";
    for (
$i 0$i count ($plot); $i++) {
        
$autodata .= "\n<font color=\"DarkRed\">•</font> ";
        
$autodata .= "$plot[$i]";
    }
}

$autodata .= "\n\n<strong><font color=\"navy\">#######################################################################</font>\n";
$autodata .= "<font color=\"darkred\" size=\"3\"> Cast:</font>\n";
$autodata .= "<font color=\"navy\">#######################################################################</font></strong>\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>\n";
}

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

    for (
$i=0;$i<count($trailers);++$i) {
    if (
$i 14) {
        break;
    }
      
$autodata .= "<a target=\"_blank\" href='".$trailers[$i]."'>".$trailers[$i]."</a>\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""\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

Vollari 2nd July 2008 20:50

Re: [TBDEV]IMDB Mod
 
Does this mod work with torrentstrike ?

Fynnon 2nd July 2008 23:08

Re: [TBDEV]IMDB Mod
 
Quote:

Originally Posted by Vollari
Does this mod work with torrentstrike ?

This is for TBDEV, i don`t know if it works for TorrentStrike but you can install XAMPP on your PC then install TorrentStrike and test if this mod is working then come back and tell us the result

:warrior:

allroms 2nd July 2008 23:10

Re: [TBDEV]IMDB Mod
 
yes it does, i installed it on my torrentstrike.

wMan 3rd July 2008 14:17

Re: [TBDEV]IMDB Mod
 
im getting this:

Code:

not valid imdbID:
0not valid imdbID:
0not valid imdbID:
0


my details.php:

Code:


ob_start("ob_gzhandler");

require_once("include/bittorrent.php");
require ("imdb/imdb.class.php");
include("include/rating_functions.php");

function getagent($httpagent)
{
    if (preg_match("/^Azureus ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches))
        return "Azureus/$matches[1]";
    elseif (preg_match("/BitTorrent\\/S-([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
        return "Shadow's/$matches[1]";
    elseif (preg_match("/BitTorrent\\/U-([0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches))
        return "UPnP/$matches[1]";
    elseif (preg_match("/^BitTorrent\\/T-(.+)$/", $httpagent, $matches))
        return "BitTornado/$matches[1]";
    elseif (preg_match("/^BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
        return "BitTorrent/$matches[1]";
    elseif (preg_match("/^Python-urllib\\/.+?, BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
        return "BitTorrent/$matches[1]";
    elseif (ereg("^BitTorrent\\/BitSpirit$", $httpagent))
        return "BitSpirit";
    elseif (preg_match("/^BitTorrent\\/brst(.+)/", $httpagent, $matches))
        return "Burst/$matches[1]";
    elseif (preg_match("/^RAZA (.+)$/", $httpagent, $matches))
        return "Shareaza/$matches[1]";
    else
        return "---";
}

function dltable($name, $arr, $torrent)
{

    global $CURUSER;
    $s = "" . count($arr) . " $name\n";
    if (!count($arr))
        return $s;
    $s .= "\n";
    $s .= "\n";
    $s .= "" .
          "".
          "".
          "".
          "" .
          "" .
          "" .
          "" .
          "" .
          "" .
          "\n";
    $now = time();
    $moderator = (isset($CURUSER) && get_user_class() >= UC_MODERATOR);
$mod = get_user_class() >= UC_MODERATOR;
    foreach ($arr as $e) {


                // user/ip/port
                // check if anyone has this ip
                ($unr = mysql_query("SELECT username, privacy FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
                $una = mysql_fetch_assoc($unr);
                if ($una["privacy"] == "strong") continue;
        $s .= "\n";
                if ($una["username"])
                  $s .= "\n";
                else
                  $s .= "\n";
        $secs = max(1, ($now - $e["st"]) - ($now - $e["la"]));
        $revived = $e["revived"] == "yes";
        $s .= "\n";
        $s .= "\n";
        $s .= "\n";
        $s .= "\n";
        if ($e["seeder"] == "no")
            $s .= "\n";
        else
            $s .= "\n";
                if ($e["downloaded"])
                {
                  $ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000;
                    $s .= "\n";
                }
                  else
                  if ($e["uploaded"])
                    $s .= "\n";
                  else
                    $s .= "\n";
        $s .= "\n";
        $s .= "\n";
        $s .= "\n";
        $s .= "\n";
        $s .= "\n";
    }
    $s .= "
User/IPConnectableUploadedRateDownloadedRateRatioCompleteConnectedIdleClient
$una[username]" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . "" . ($e[connectable] == "yes" ? "Yes" : "No") . "" . mksize($e["uploaded"]) . "" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s" . mksize($e["downloaded"]) . "" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st])) .    "/s" . number_format($ratio, 3) . "Inf.---" . sprintf("%.2f%%", 100 * (1 - ($e["to_go"] / $torrent["size"]))) . "" . mkprettytime($now - $e["st"]) . "" . mkprettytime($now - $e["la"]) . "" . htmlspecialchars(getagent($e["agent"])) . "
\n";
    return $s;
}

dbconn(false);


loggedinorreturn();

$id = 0 + $_GET["id"];

if (!isset($id) || !$id)
    die();

$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.points, LENGTH(torrents.nfo) AS nfosz, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.owner, torrents.save_as, torrents.descr, torrents.url, torrents.poster, torrents.tube, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id")
    or sqlerr();
$row = mysql_fetch_assoc($res);

$owned = $moderator = 0;
    if (get_user_class() >= UC_MODERATOR)
        $owned = $moderator = 1;
    elseif ($CURUSER["id"] == $row["owner"])
        $owned = 1;
//}

if (!$row || ($row["banned"] == "yes" && !$moderator))
    stderr("Error", "No torrent with ID.");
else {
    if ($_GET["hit"]) {
        mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
        if ($_GET["tocomm"])
            header("Location: $BASEURL/details.php?id=$id&page=0#startcomments");
        elseif ($_GET["filelist"])
            header("Location: $BASEURL/details.php?id=$id&filelist=1#filelist");
        elseif ($_GET["toseeders"])
            header("Location: $BASEURL/details.php?id=$id&dllist=1#seeders");
        elseif ($_GET["todlers"])
            header("Location: $BASEURL/details.php?id=$id&dllist=1#leechers");
        else
            header("Location: $BASEURL/details.php?id=$id");
        exit();
    }

    if (!isset($_GET["page"])) {
        stdhead("Details for torrent \"" . $row["name"] . "\"");

        if ($CURUSER["id"] == $row["owner"] || get_user_class() >= UC_MODERATOR)
            $owned = 1;
        else
            $owned = 0;

        $spacer = "";

        if ($_GET["uploaded"]) {
            print("

Successfully uploaded!

\n");
            print("

You can start seeding now. Note that the torrent won't be visible until you do that!

\n");
        }
        elseif ($_GET["edited"]) {
            print("

Successfully edited!

\n");
            if (isset($_GET["returnto"]))
                print("

Go back to whence you came.

\n");
        }
        elseif (isset($_GET["searched"])) {
            print("

Your search for \"" . htmlspecialchars($_GET["searched"]) . "\" gave a single result:

\n");
        }
        elseif ($_GET["rated"]) {
 print("

Rating added!

\n");
}
elseif ($_GET["thanks"])
 print("

Thanks added!

\n");

$s=$row["name"];
        print("

$s

\n");
                print("\n");

        $url = "edit.php?id=" . $row["id"];
        if (isset($_GET["returnto"])) {
            $addthis = "&returnto=" . urlencode($_GET["returnto"]);
            $url .= $addthis;
            $keepget .= $addthis;
        }
        $editlink = "a href=\"$url\" class=\"sublink\"";

//        $s = "" . htmlspecialchars($row["name"]) . "";
//        if ($owned)
//            $s .= " $spacer<$editlink>[Edit torrent]";
//        tr("Name", $s, 1);
                if ($CURUSER["id"] == $row["owner"]) $CURUSER["downloadpos"] = "yes";
                if ($CURUSER["downloadpos"] != "no")
                {
        print("");
//        tr("Downloadsas", $row["save_as"]);
/// Mod by dokty - tbdev.net
$blasd = mysql_query("SELECT points FROM coins WHERE torrentid=$id AND userid=".$CURUSER["id"]);
$sdsa = mysql_fetch_assoc($blasd) or $sdsa["points"] = 0;

tr("Points","In total ".$row["points"]." Points given to this torrent of which ".$sdsa["points"]." from you.

By clicking on the coins you can give points to the uploader of this torrent.


", 1);
        function hex_esc($matches) {
            return sprintf("%02x", ord($matches[0]));
        }
        tr("Info hash", preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])));
                }
                else {
                tr("Download", "You are not allowed to download");
                }
        print("\n");
        #if (!empty($row["descr"]))
            #tr("Description", str_replace(array("\n", "  "), array("
\n", " "), format_comment(htmlspecialchars($row["descr"]))), 1);
                if (!empty($row["tube"]))
tr("Sample:", "", 1);
else
tr("YouTube", "", 1);
                if (!empty($row["poster"]))
tr("Picture", "[img]".$row["poster"]."[/img]

Click For Full Picture", 1);
//tr("Picture", "[img]".$row["poster"]."[/img]", 1);
else
tr("Picture", "", 1);
      //auto imdb mod
            if (($row["url"] != "")AND(strpos($row["url"], imdb))AND(strpos($row["url"], title)))
            echo "";
              {
            $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();
            $trailer = $movie->trailer();
            if (($photo_url = $movie->photo_localurl() ) != FALSE) {
            $smallth = '[img]'.$photo_url.'[/img]';
            }

            $autodata = "#######################################################################
\n";
            $autodata .= "Information:
\n";
            $autodata .= "#######################################################################

\n";
            $autodata .= " Title: " . "".$movie->title ()."
\n";
            $autodata .= " Also known as: ";

    foreach ( $movie->alsoknow() as $ak){
            $autodata .= "".$ak["title"]."" . "".$ak["year"].""  . "".$ak["country"]."" . " (" . "".$ak["comment"]."" . ")" . ", ";
    }
            $autodata .= "
\n Year: " . "".$movie->year ()."
\n";
            $autodata .= " Runtime: " . "".$movie->runtime ()."" . " mins
\n";
            $autodata .= " Votes: " . "".$movie->votes ()."
\n";
            $autodata .= " Rating: " . "".$movie->rating ()."
\n";
            $autodata .= " Language: " . "".$movie->language ()."
\n";
            $autodata .= " Country: ";
               
    for ($i = 0; $i + 1 < count ($country); $i++) {
            $autodata .="$country[$i], ";
    }
            $autodata .= "$country[$i]";
            $autodata .= "
\n All Genres: ";
            for ($i = 0; $i + 1 < count($gen); $i++) {
            $autodata .= "$gen[$i], ";
  }
            $autodata .= "$gen[$i]";
            $autodata .= "
\n Tagline: " . "".$movie->tagline ()."
\n";
            $autodata .= " Director: ";

    for ($i = 0; $i < count ($director); $i++) {
            $autodata .= "" . "".$director[$i]["name"]."" . " ";
    }
     
            $autodata .= "
\n Writing By: ";
    for ($i = 0; $i < count ($write); $i++) {
            $autodata .= "" . "".$write[$i]["name"]."" . " ";
    }
     
          $autodata .= "
\n Produced By: ";
    for ($i = 0; $i < count ($produce); $i++) {
          $autodata .= "" . "".$produce[$i]["name"]."" . " ";
    }
         
          $autodata .= "
\n Music: ";         
  for ($i = 0; $i < count($compose); $i++) {
          $autodata .= "" . "".$compose[$i]["name"]."" . " ";   
    }

          $autodata .= "

\n\n#######################################################################
\n";
          $autodata .= " Description:
\n";
          $autodata .= "#######################################################################
";
    for ($i = 0; $i < count ($plot); $i++) {
          $autodata .= "
\n
" . htmlspecialchars($row["filename"]) . "
Description: klappe_news('a1')\">
\"[Hide/Show]\"
" . str_replace(array("\n", "  "), array("
\n", " "), format_comment(htmlspecialchars($row["descr"]))) . "

joeroberts 5th July 2008 14:40

Re: [TBDEV]IMDB Mod
 
lol works on PMBT with allot of modding only error is the trailers dont work as they change the links all the time because the advertizing

NatashaRhea 6th September 2008 21:13

wow thanks i didnt realize i could put xampp on pc thanks for the information saves me crashing the server each time i make mistakes :drink::hi::superstition:

Ingvar 9th May 2009 02:41

Looking for someone to put IMDB mod on my TBSource tracker, its mostly translated in Icelandic. (not codes tho)

Will pay for the work, need this mod and 3-4 others.

tekmobile 2nd May 2010 14:08

Just been looking to see if this would work with TS 0.5 and found that I was getting parse errors so looked through the code and noticed that the quotes around the nofollow were not escaped in the code for details.php

PHP Code:

      $autodata .= "<a rel="nofollow

changed to
PHP Code:

      $autodata .= "<a rel=\"nofollow\" 

after correcting this it does seem to work okay

rabtb 8th October 2010 04:08

posters not working now iv noticed on alot of sites there missing anyone got a fix for it yet ?


All times are GMT +2. The time now is 02:18.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.