torrents list imdb rating

This commit is contained in:
xiaomlove
2021-01-18 19:45:33 +08:00
parent 16df59db5b
commit 2f7e613549
12 changed files with 210 additions and 223 deletions

View File

@@ -2982,6 +2982,12 @@ function torrenttable($res, $variant = "torrent") {
global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak; global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak;
global $CURLANGDIR; global $CURLANGDIR;
$setting = get_setting('main');
$enablePtGen = $setting['enable_pt_gen_system'] == 'yes';
if ($enablePtGen) {
$ptGen = new Nexus\PTGen\PTGen();
}
if ($variant == "torrent"){ if ($variant == "torrent"){
$last_browse = $CURUSER['last_browse']; $last_browse = $CURUSER['last_browse'];
$sectiontype = $browsecatmode; $sectiontype = $browsecatmode;
@@ -3178,7 +3184,9 @@ while ($row = mysql_fetch_assoc($res))
print($dissmall_descr == "" ? "" : "<br />".htmlspecialchars($dissmall_descr)); print($dissmall_descr == "" ? "" : "<br />".htmlspecialchars($dissmall_descr));
} }
print("</td>"); print("</td>");
if ($enablePtGen && !empty($row['pt_gen'])) {
echo $ptGen->renderTorrentsPageAverageRating(json_decode($row['pt_gen'], true));
}
$act = ""; $act = "";
if ($CURUSER["dlicon"] != 'no' && $CURUSER["downloadpos"] != "no") if ($CURUSER["dlicon"] != 'no' && $CURUSER["downloadpos"] != "no")
$act .= "<a href=\"download.php?id=".$id."\"><img class=\"download\" src=\"pic/trans.gif\" style='padding-bottom: 2px;' alt=\"download\" title=\"".$lang_functions['title_download_torrent']."\" /></a>" ; $act .= "<a href=\"download.php?id=".$id."\"><img class=\"download\" src=\"pic/trans.gif\" style='padding-bottom: 2px;' alt=\"download\" title=\"".$lang_functions['title_download_torrent']."\" /></a>" ;

View File

@@ -294,6 +294,10 @@ $lang_functions = array
'text_pt_gen_imdb_url_note' => "(来自 <strong><a href=\"https://www.imdb.com//\">imdb</a></strong> 的链接。如电影 <b>Transformers</b> 的链接是<b> https://www.imdb.com/title/tt0418279/</b>)", 'text_pt_gen_imdb_url_note' => "(来自 <strong><a href=\"https://www.imdb.com//\">imdb</a></strong> 的链接。如电影 <b>Transformers</b> 的链接是<b> https://www.imdb.com/title/tt0418279/</b>)",
'row_pt_gen_bangumi_url' => "PT-Gen bangumi 链接", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 链接",
'text_pt_gen_bangumi_url_note' => "(来自 <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong> 的链接。如动画 <b>星际牛仔</b> 的链接是<b> https://bangumi.tv/subject/253/</b>)", 'text_pt_gen_bangumi_url_note' => "(来自 <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong> 的链接。如动画 <b>星际牛仔</b> 的链接是<b> https://bangumi.tv/subject/253/</b>)",
'imdb_cache_dir_can_not_create' => 'imdb 缓存目录无法创建',
'imdb_cache_dir_is_not_writeable' => 'imdb 缓存目录不可写',
'imdb_photo_dir_can_not_create' => 'imdb 图片目录无法创建',
'imdb_photo_dir_is_not_writeable' => 'imdb 图片目录不可写',
); );
?> ?>

View File

@@ -293,6 +293,10 @@ $lang_functions = array
'text_pt_gen_imdb_url_note' => "(來自 <strong><a href=\"https://www.imdb.com//\">imdb</a></strong> 的鏈接。如電影 <b>Transformers</b> 的鏈接是<b> https://www.imdb.com/title/tt0418279/</b>)", 'text_pt_gen_imdb_url_note' => "(來自 <strong><a href=\"https://www.imdb.com//\">imdb</a></strong> 的鏈接。如電影 <b>Transformers</b> 的鏈接是<b> https://www.imdb.com/title/tt0418279/</b>)",
'row_pt_gen_bangumi_url' => "PT-Gen bangumi 鏈接", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 鏈接",
'text_pt_gen_bangumi_url_note' => "(來自 <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong> 的鏈接。如動畫 <b>星際牛仔</b> 的鏈接是<b> https://bangumi.tv/subject/253/</b>)", 'text_pt_gen_bangumi_url_note' => "(來自 <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong> 的鏈接。如動畫 <b>星際牛仔</b> 的鏈接是<b> https://bangumi.tv/subject/253/</b>)",
'imdb_cache_dir_can_not_create' => 'imdb 緩存目錄無法創建',
'imdb_cache_dir_is_not_writeable' => 'imdb 緩存目錄不可寫',
'imdb_photo_dir_can_not_create' => 'imdb 圖片目錄無法創建',
'imdb_photo_dir_is_not_writeable' => 'imdb 圖片目錄不可寫',
); );
?> ?>

View File

@@ -294,6 +294,10 @@ $lang_functions = array
'text_pt_gen_imdb_url_note' => "(URL taken from <strong><a href=\"https://www.imdb.com/\">imdb</a></strong>. e.g.&nbsp;for movie <b>Transformers</b> the URL is <b> https://www.imdb.com/title/tt0418279/</b>)", 'text_pt_gen_imdb_url_note' => "(URL taken from <strong><a href=\"https://www.imdb.com/\">imdb</a></strong>. e.g.&nbsp;for movie <b>Transformers</b> the URL is <b> https://www.imdb.com/title/tt0418279/</b>)",
'row_pt_gen_bangumi_url' => "PT-Gen bangumi link", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi link",
'text_pt_gen_bangumi_url_note' => "(URL taken from <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong>. e.g.&nbsp;for animation <b>Cowboy Bebop</b> the URL is <b>https://bangumi.tv/subject/253/</b>)", 'text_pt_gen_bangumi_url_note' => "(URL taken from <strong><a href=\"https://bangumi.tv/\">bangumi</a></strong>. e.g.&nbsp;for animation <b>Cowboy Bebop</b> the URL is <b>https://bangumi.tv/subject/253/</b>)",
'imdb_cache_dir_can_not_create' => 'imdb cache dir can not create',
'imdb_cache_dir_is_not_writeable' => 'imdb cache dir is not writeable',
'imdb_photo_dir_can_not_create' => 'imdb photo dir can not create',
'imdb_photo_dir_is_not_writeable' => 'imdb photo dir is not writeable',
); );
?> ?>

View File

@@ -9,18 +9,112 @@ class Imdb
{ {
private $config; private $config;
private $movie;
private $pages = array('Title', 'Credits', 'Amazon', 'Goofs', 'Plot', 'Comments', 'Quotes', 'Taglines', 'Plotoutline', 'Trivia', 'Directed');
public function __construct() public function __construct()
{ {
$config = new Config(); $config = new Config();
$config->cachedir = ROOT_PATH . 'imdb/cache'; $cacheDir = ROOT_PATH . 'imdb/cache/';
$config->photodir = ROOT_PATH . 'imdb/pic_imdb'; $photoRoot = 'images/';
$config->photoroot = 'pic_imdb'; $photoDir = ROOT_PATH . "imdb/$photoRoot";
$this->checkDir($cacheDir, 'imdb_cache_dir');
$this->checkDir($photoDir, 'imdb_photo_dir');
$config->cachedir = $cacheDir;
$config->photodir = $photoDir;
$config->photoroot = $photoRoot;
$this->config = $config; $this->config = $config;
} }
private function checkDir($dir, $langKeyPrefix)
{
global $lang_functions;
if (!is_dir($dir)) {
$mkdirResult = mkdir($dir, 0777, true);
if ($mkdirResult !== true) {
$msg = $lang_functions["{$langKeyPrefix}_can_not_create"];
do_log("$msg, dir: $dir");
throw new ImdbException($msg);
}
}
if (!is_writable($dir)) {
$msg = $lang_functions["{$langKeyPrefix}_is_not_writeable"];
do_log("$msg, dir: $dir");
throw new ImdbException($msg);
}
return true;
}
public function getCachedAt(int $id, string $page)
{
$id = parse_imdb_id($id);
$log = "id: $id, page: $page";
$cacheFile = $this->getCacheFilePath($id, $page);
if (!file_exists($cacheFile)) {
$log .= ", file: $cacheFile not exits";
}
$result = filemtime($cacheFile);
$log .= ", cache at: $result";
do_log($log);
return $result;
}
/**
* @date 2021/1/18
* @param int $id
* @param string $page Title, Credits, etc...
* @return int state (0-not complete, 1-cache complete)
*/
public function getCacheStatus(int $id, string $page)
{
return 1;
$id = parse_imdb_id($id);
$log = "id: $id, page: $page";
$cacheFile = $this->getCacheFilePath($id, $page);
if (!file_exists($cacheFile)) {
$log .= ", file: $cacheFile not exits";
do_log($log);
return 0;
}
if (!fopen($cacheFile, 'r')) {
$log .= ", file: $cacheFile can not open";
do_log($log);
return 0;
}
return 1;
}
public function purgeSingle($id)
{
foreach ($this->pages as $page) {
$file = $this->getCacheFilePath($id, $page);
if (file_exists($file)) {
unlink($file);
}
}
return true;
}
public function getMovie($id)
{
if (!$this->movie) {
$this->movie = new Title($id, $this->config);
}
return $this->movie;
}
private function getCacheFilePath($id, $page)
{
return sprintf('%s%s.%s', $this->config->cachedir, $id, $page);
}
public function renderDetailsPageDescription($torrentId, $imdbId) public function renderDetailsPageDescription($torrentId, $imdbId)
{ {
$movie = new Title($imdbId, $this->config); global $lang_details;
$movie = $this->getMovie($imdbId);
$thenumbers = $imdbId;
$country = $movie->country (); $country = $movie->country ();
$director = $movie->director(); $director = $movie->director();
$creator = $movie->creator(); // For TV series $creator = $movie->creator(); // For TV series
@@ -32,12 +126,7 @@ class Imdb
$compose = $movie->composer(); $compose = $movie->composer();
$gen = $movie->genres(); $gen = $movie->genres();
//$comment = $movie->comment(); //$comment = $movie->comment();
$similiar_movies = $movie->similiar_movies(); // $similiar_movies = $movie->similiar_movies();
if (($photo_url = $movie->photo_localurl() ) != FALSE)
$smallth = "<img src=\"".$photo_url. "\" width=\"105\" onclick=\"Preview(this);\" alt=\"poster\" />";
else
$smallth = "<img src=\"pic/imdb_pic/nophoto.gif\" alt=\"no poster\" />";
$autodata = '<a href="https://www.imdb.com/title/tt'.$thenumbers.'">https://www.imdb.com/title/tt'.$thenumbers."</a><br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n"; $autodata = '<a href="https://www.imdb.com/title/tt'.$thenumbers.'">https://www.imdb.com/title/tt'.$thenumbers."</a><br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_information']."</font><br />\n"; $autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_information']."</font><br />\n";
@@ -48,11 +137,10 @@ class Imdb
$temp = ""; $temp = "";
foreach ($movie->alsoknow() as $ak) foreach ($movie->alsoknow() as $ak)
{ {
// $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", "; $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", ";
$temp .= $ak["title"] . ", ";
} }
$autodata .= rtrim(trim($temp), ","); $autodata .= rtrim(trim($temp), ",");
$runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime_all()); $runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime());
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_year']."</font></strong>" . "".$movie->year ()."<br />\n"; $autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_year']."</font></strong>" . "".$movie->year ()."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_runtime']."</font></strong>".$runtimes."<br />\n"; $autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_runtime']."</font></strong>".$runtimes."<br />\n";
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_votes']."</font></strong>" . "".$movie->votes ()."<br />\n"; $autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_votes']."</font></strong>" . "".$movie->votes ()."<br />\n";
@@ -139,12 +227,14 @@ class Imdb
for ($i = 0; $i < count ($cast); $i++) for ($i = 0; $i < count ($cast); $i++)
{ {
// if ($i > 9) if ($i > 9)
// { {
// break; break;
// } }
$autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n"; $autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
} }
return $autodata;
} }
} }

View File

@@ -0,0 +1,8 @@
<?php
namespace Nexus\Imdb;
class ImdbException extends \Exception
{
}

View File

@@ -22,14 +22,17 @@ class PTGen
self::SITE_IMDB => [ self::SITE_IMDB => [
'url_pattern' => '/(?:https?:\/\/)?(?:www\.)?imdb\.com\/title\/(tt\d+)\/?/', 'url_pattern' => '/(?:https?:\/\/)?(?:www\.)?imdb\.com\/title\/(tt\d+)\/?/',
'home_page' => 'https://www.imdb.com/', 'home_page' => 'https://www.imdb.com/',
'rating_average_img' => 'pic/imdb2.png',
], ],
self::SITE_DOUBAN => [ self::SITE_DOUBAN => [
'url_pattern' => '/(?:https?:\/\/)?(?:(?:movie|www)\.)?douban\.com\/(?:subject|movie)\/(\d+)\/?/', 'url_pattern' => '/(?:https?:\/\/)?(?:(?:movie|www)\.)?douban\.com\/(?:subject|movie)\/(\d+)\/?/',
'home_page' => 'https://www.douban.com/', 'home_page' => 'https://www.douban.com/',
'rating_average_img' => 'pic/douban2.png',
], ],
self::SITE_BANGUMI => [ self::SITE_BANGUMI => [
'url_pattern' => '/(?:https?:\/\/)?(?:bgm\.tv|bangumi\.tv|chii\.in)\/subject\/(\d+)\/?/', 'url_pattern' => '/(?:https?:\/\/)?(?:bgm\.tv|bangumi\.tv|chii\.in)\/subject\/(\d+)\/?/',
'home_page' => 'https://bangumi.tv/', 'home_page' => 'https://bangumi.tv/',
'rating_average_img' => 'pic/douban2.png',
], ],
]; ];
@@ -205,4 +208,27 @@ HTML;
} }
return ['json_arr' => $jsonArr, 'html' => $html, 'update' => $update]; return ['json_arr' => $jsonArr, 'html' => $html, 'update' => $update];
} }
public function renderTorrentsPageAverageRating(array $ptGenData)
{
$result = '<td class="embedded" style="text-align: right; width: 40px;padding-right: 5px"><div style="display: flex;flex-direction: column">';
$count = 1;
foreach (self::$validSites as $site => $info) {
$rating = $ptGenData[$site]['data']["{$site}_rating_average"] ?? '';
if (empty($rating)) {
continue;
}
if ($count > 2) {
//only show the first two
break;
}
$result .= sprintf(
'<div style="display: flex;align-content: center;justify-content: space-between;padding: 2px 0"><img src="%s" alt="%s" title="%s" style="max-width: 16px;max-height: 16px"/><span>%s</span></div>',
$info['rating_average_img'], $site, $site, $rating
);
$count++;
}
$result .= '</div></td>';
return $result;
}
} }

View File

@@ -3,10 +3,7 @@ ob_start(); //Do not delete this line
require_once("../include/bittorrent.php"); require_once("../include/bittorrent.php");
dbconn(); dbconn();
require_once(get_langfile_path()); require_once(get_langfile_path());
if ($showextinfo['imdb'] == 'yes')
require_once("imdb/imdb.class.php");
loggedinorreturn(); loggedinorreturn();
$id = intval($_GET["id"] ?? 0); $id = intval($_GET["id"] ?? 0);
int_check($id); int_check($id);
@@ -30,6 +27,12 @@ else {
$torrentUpdate[] = 'views = views + 1'; $torrentUpdate[] = 'views = views + 1';
} }
$imdb_id = parse_imdb_id($row["url"]);
if ($imdb_id && $showextinfo['imdb'] == 'yes') {
$imdb = new \Nexus\Imdb\Imdb();
$movie = $imdb->getMovie($imdb_id);
}
if (!isset($_GET["cmtpage"])) { if (!isset($_GET["cmtpage"])) {
stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\""); stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\"");
@@ -132,14 +135,11 @@ else {
print("<td class=\"embedded\"><form method=\"post\" action=\"subtitles.php\"><input type=\"hidden\" name=\"torrent_name\" value=\"" . $row["name"]. "\" /><input type=\"hidden\" name=\"detail_torrent_id\" value=\"" . $row["id"]. "\" /><input type=\"hidden\" name=\"in_detail\" value=\"in_detail\" /><input type=\"submit\" value=\"".$lang_details['submit_upload_subtitles']."\" /></form></td>"); print("<td class=\"embedded\"><form method=\"post\" action=\"subtitles.php\"><input type=\"hidden\" name=\"torrent_name\" value=\"" . $row["name"]. "\" /><input type=\"hidden\" name=\"detail_torrent_id\" value=\"" . $row["id"]. "\" /><input type=\"hidden\" name=\"in_detail\" value=\"in_detail\" /><input type=\"submit\" value=\"".$lang_details['submit_upload_subtitles']."\" /></form></td>");
} }
$moviename = ""; $moviename = "";
$imdb_id = parse_imdb_id($row["url"]);
if ($imdb_id && $showextinfo['imdb'] == 'yes') if ($imdb_id && $showextinfo['imdb'] == 'yes')
{ {
$thenumbers = $imdb_id; $thenumbers = $imdb_id;
if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){ if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){
$movie = new imdb ($thenumbers); switch ($imdb->getCacheStatus($imdb_id, 'Title')){
$target = array('Title');
switch ($movie->cachestate($target)){
case "1":{ case "1":{
$moviename = $movie->title (); break; $moviename = $movie->title (); break;
$Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000); $Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000);
@@ -172,205 +172,49 @@ else {
$Cache->new_page('imdb_id_'.$thenumbers.'_large', 1296000, true); $Cache->new_page('imdb_id_'.$thenumbers.'_large', 1296000, true);
if (!$Cache->get_page()){ if (!$Cache->get_page()){
$movie = new imdb ($thenumbers); switch ($imdb->getCacheStatus($imdb_id, 'Title'))
$movieid = $thenumbers;
$movie->setid ($movieid);
$target = array('Title', 'Credits', 'Plot');
switch ($movie->cachestate($target))
{ {
case "0" : //cache is not ready, try to case "0" : //cache is not ready, try to
{ {
if($row['cache_stamp']==0 || ($row['cache_stamp'] != 0 && (time()-$row['cache_stamp']) > $auto_obj->timeout)) //not exist or timed out if($row['cache_stamp']==0 || ($row['cache_stamp'] != 0 && (time()-$row['cache_stamp']) > 120)) //not exist or timed out
tr($lang_details['text_imdb'] . $lang_details['row_info'] , $lang_details['text_imdb'] . $lang_details['text_not_ready']."<a href=\"retriver.php?id=". $id ."&amp;type=1&amp;siteid=1\">".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1); tr($lang_details['text_imdb'] . $lang_details['row_info'] , $lang_details['text_imdb'] . $lang_details['text_not_ready']."<a href=\"retriver.php?id=". $id ."&amp;type=1&amp;siteid=1\">".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1);
else else
tr($lang_details['text_imdb'] . $lang_details['row_info'] , "<img src=\"pic/progressbar.gif\" alt=\"\" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $lang_details['text_someone_has_requested'] . $lang_details['text_imdb'] . " ".min(max(time()-$row['cache_stamp'],0),$auto_obj->timeout) . $lang_details['text_please_be_patient'],1); tr($lang_details['text_imdb'] . $lang_details['row_info'] , "<img src=\"pic/progressbar.gif\" alt=\"\" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $lang_details['text_someone_has_requested'] . $lang_details['text_imdb'] . " ".min(max(time()-$row['cache_stamp'],0),120) . $lang_details['text_please_be_patient'],1);
break; break;
} }
case "1" : case "1" :
{ {
reset_cachetimestamp($row['id']); reset_cachetimestamp($row['id']);
$country = $movie->country (); if (($photo_url = $movie->photo_localurl() ) != FALSE)
$director = $movie->director(); $smallth = "<img src=\"".$photo_url. "\" width=\"105\" onclick=\"Preview(this);\" alt=\"poster\" />";
$creator = $movie->creator(); // For TV series else
$write = $movie->writing(); $smallth = "<img src=\"pic/nophoto.gif\" alt=\"no poster\" />";
$produce = $movie->producer();
$cast = $movie->cast();
// $plot = $movie->plot ();
$plot_outline = $movie->plotoutline();
$compose = $movie->composer();
$gen = $movie->genres();
//$comment = $movie->comment();
$similiar_movies = $movie->similiar_movies();
if (($photo_url = $movie->photo_localurl() ) != FALSE) $autodata = $imdb->renderDetailsPageDescription($row['id'], $imdb_id);
$smallth = "<img src=\"".$photo_url. "\" width=\"105\" onclick=\"Preview(this);\" alt=\"poster\" />"; $cache_time = $imdb->getCachedAt($imdb_id, 'Title');
else $Cache->add_whole_row();
$smallth = "<img src=\"pic/imdb_pic/nophoto.gif\" alt=\"no poster\" />"; print("<tr>");
print("<td class=\"rowhead\"><a href=\"javascript: klappe_ext('imdb')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picimdb\" title=\"".$lang_details['title_show_or_hide']."\" /> ".$lang_details['text_imdb'] . $lang_details['row_info'] ."</span></a><div id=\"posterimdb\">". $smallth."</div></td>");
$autodata = '<a href="https://www.imdb.com/title/tt'.$thenumbers.'">https://www.imdb.com/title/tt'.$thenumbers."</a><br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n"; $Cache->end_whole_row();
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_information']."</font><br />\n"; $Cache->add_row();
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n"; $Cache->add_part();
$autodata .= "<strong><font color=\"DarkRed\">". $lang_details['text_title']."</font></strong>" . "".$movie->title ()."<br />\n"; print("<td class=\"rowfollow\" align=\"left\"><div id='kimdb'>".$autodata);
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_also_known_as']."</font></strong>"; $Cache->end_part();
$Cache->add_part();
$temp = ""; print($lang_details['text_information_updated_at'] . date("Y-m-d H:i:s", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
foreach ($movie->alsoknow() as $ak) $Cache->end_part();
{ $Cache->end_row();
// $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", "; $Cache->add_whole_row();
$temp .= $ak["title"] . ", "; print("</div></td></tr>");
} $Cache->end_whole_row();
$autodata .= rtrim(trim($temp), ","); $Cache->cache_page();
$runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime_all()); echo $Cache->next_row();
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_year']."</font></strong>" . "".$movie->year ()."<br />\n"; $Cache->next_row();
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_runtime']."</font></strong>".$runtimes."<br />\n"; echo $Cache->next_part();
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_votes']."</font></strong>" . "".$movie->votes ()."<br />\n"; if (get_user_class() >= $updateextinfo_class)
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_rating']."</font></strong>" . "".$movie->rating ()."<br />\n"; echo $Cache->next_part();
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_language']."</font></strong>" . "".$movie->language ()."<br />\n"; echo $Cache->next_row();
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_country']."</font></strong>"; break;
$temp = "";
for ($i = 0; $i < count ($country); $i++)
{
$temp .="$country[$i], ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_all_genres']."</font></strong>";
$temp = "";
for ($i = 0; $i < count($gen); $i++)
{
$temp .= "$gen[$i], ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_tagline']."</font></strong>" . "".$movie->tagline ()."<br />\n";
if ($director){
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_director']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($director); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$director[$i]["imdb"]."" ."\">" . $director[$i]["name"] . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
}
elseif ($creator)
$autodata .= "<strong><font color=\"DarkRed\">".$lang_details['text_creator']."</font></strong>".$creator;
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_written_by']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($write); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_produced_by']."</font></strong>";
$temp = "";
for ($i = 0; $i < count ($produce); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br />\n<strong><font color=\"DarkRed\">".$lang_details['text_music']."</font></strong>";
$temp = "";
for ($i = 0; $i < count($compose); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_plot_outline']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
// if(count($plot) == 0)
// {
// $autodata .= "<br />\n".$plot_outline;
// }
// else
// {
// for ($i = 0; $i < count ($plot); $i++)
// {
// $autodata .= "<br />\n<font color=\"DarkRed\">.</font> ";
// $autodata .= $plot[$i];
// }
// }
if (!empty($plot_outline)) {
$autodata .= "<br />\n".$plot_outline;
}
$autodata .= "<br /><br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_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=\"https://www.imdb.com/" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
}
/*$autodata .= "<br /><strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_may_also_like']."</font><br />\n";
$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong><br />\n";
$autodata .= "<table cellpadding=\"10\"><tr>";
if($similiar_movies)
{
$counter = 0;
foreach($similiar_movies as $similiar_movies_each)
{
$on_site = "";
$imdb_config_inst = new imdb_config();
if($imdb_id_new = parse_imdb_id($imdb_config_inst->imdbsite . $similiar_movies_each['Link']))
{
$similiar_res = sql_query("SELECT id FROM torrents WHERE url = " . sqlesc((int)$imdb_id_new) . " AND id != ".sqlesc($id)." ORDER BY RAND() LIMIT 1") or sqlerr(__FILE__, __LINE__);
while($similiar_arr = mysql_fetch_array($similiar_res)) {
$on_site = "<strong><a href=\"" .htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $similiar_arr['id'] . "&hit=1")."\">" . $lang_details['text_local_link'] . "</a></strong>";
}
}
$autodata .= ($counter == 5 ? "</tr><tr>" : "" ) . "<td align=\"center\" style=\"border: 0px; padding-left: 20px; padding-right: 20px; padding-bottom: 10px\"><a href=\"" . $movie->protocol_prefix . $movie->imdbsite . $similiar_movies_each['Link'] . "\" title=\"\"><img style=\"border:0px;\" src=\"" . $similiar_movies_each['Local'] . "\" alt=\"" . $similiar_movies_each['Name'] . "\" /><br />" . $similiar_movies_each['Name'] . "</a><br />" . ($on_site != "" ? $on_site : "&nbsp;") . "</td>";
$counter++;
}
}
$autodata .= "</tr></table>";*/
//$autodata .= "<br />\n\n<strong><font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font><br />\n";
//$autodata .= "<font color=\"darkred\" size=\"3\">".$lang_details['text_recommended_comment']."</font><br />\n";
//$autodata .= "<font color=\"navy\">------------------------------------------------------------------------------------------------------------------------------------</font></strong>";
//$autodata .= "<br />".$comment;
$cache_time = $movie->getcachetime();
$Cache->add_whole_row();
print("<tr>");
print("<td class=\"rowhead\"><a href=\"javascript: klappe_ext('imdb')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picimdb\" title=\"".($lang_details['title_show_or_hide'] ?? '')."\" /> ".$lang_details['text_imdb'] . $lang_details['row_info'] ."</span></a><div id=\"posterimdb\">". $smallth."</div></td>");
$Cache->end_whole_row();
$Cache->add_row();
$Cache->add_part();
print("<td class=\"rowfollow\" align=\"left\"><div id='kimdb'>".$autodata);
$Cache->end_part();
$Cache->add_part();
print($lang_details['text_information_updated_at'] . date("Y-m-d H:i:s", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
$Cache->end_part();
$Cache->end_row();
$Cache->add_whole_row();
print("</div></td></tr>");
$Cache->end_whole_row();
$Cache->cache_page();
echo $Cache->next_row();
$Cache->next_row();
echo $Cache->next_part();
if (get_user_class() >= $updateextinfo_class)
echo $Cache->next_part();
echo $Cache->next_row();
break;
} }
case "2" : case "2" :
{ {

BIN
public/pic/douban2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
public/pic/imdb2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,6 +1,5 @@
<?php <?php
require_once("../include/bittorrent.php"); require_once("../include/bittorrent.php");
require ("imdb/imdb.class.php");
dbconn(); dbconn();
loggedinorreturn(); loggedinorreturn();
if (get_user_class() < $updateextinfo_class) { if (get_user_class() < $updateextinfo_class) {
@@ -27,13 +26,12 @@ switch ($siteid)
if ($imdb_id) if ($imdb_id)
{ {
$thenumbers = $imdb_id; $thenumbers = $imdb_id;
$movie = new imdb ($thenumbers); $imdb = new \Nexus\Imdb\Imdb();
$movie = $imdb->getMovie($imdb_id);
$movieid = $thenumbers; $movieid = $thenumbers;
$movie->setid ($movieid);
$target = array('Title', 'Credits', 'Plot'); $target = array('Title', 'Credits', 'Plot');
($type == 2 ? $movie->purge_single(true) : ""); ($type == 2 ? $imdb->purgeSingle($imdb_id) : "");
set_cachetimestamp($id,"cache_stamp"); set_cachetimestamp($id,"cache_stamp");
$movie->preparecache($target,true);
$Cache->delete_value('imdb_id_'.$thenumbers.'_movie_name'); $Cache->delete_value('imdb_id_'.$thenumbers.'_movie_name');
$Cache->delete_value('imdb_id_'.$thenumbers.'_large', true); $Cache->delete_value('imdb_id_'.$thenumbers.'_large', true);
$Cache->delete_value('imdb_id_'.$thenumbers.'_median', true); $Cache->delete_value('imdb_id_'.$thenumbers.'_median', true);

View File

@@ -4,8 +4,10 @@ dbconn(true);
require_once(get_langfile_path("torrents.php")); require_once(get_langfile_path("torrents.php"));
loggedinorreturn(); loggedinorreturn();
parked(); parked();
if ($showextinfo['imdb'] == 'yes') if ($showextinfo['imdb'] == 'yes') {
require_once ("imdb/imdb.class.php"); $imdb = new \Nexus\Imdb\Imdb();
}
//check searchbox //check searchbox
$sectiontype = $browsecatmode; $sectiontype = $browsecatmode;
$showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not $showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not
@@ -40,7 +42,6 @@ $column = '';
$ascdesc = ''; $ascdesc = '';
if (isset($_GET['sort']) && $_GET['sort'] && isset($_GET['type']) && $_GET['type']) { if (isset($_GET['sort']) && $_GET['sort'] && isset($_GET['type']) && $_GET['type']) {
switch($_GET['sort']) { switch($_GET['sort']) {
case '1': $column = "name"; break; case '1': $column = "name"; break;
case '2': $column = "numfiles"; break; case '2': $column = "numfiles"; break;
@@ -858,10 +859,10 @@ if ($count)
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam); list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam);
if ($allsec == 1 || $enablespecial != 'yes'){ if ($allsec == 1 || $enablespecial != 'yes'){
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit"; $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit";
} }
else{ else{
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit"; $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
} }
$res = sql_query($query) or die(mysql_error()); $res = sql_query($query) or die(mysql_error());