From 2f7e613549eea089be3d748f1300bd57368590cf Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Mon, 18 Jan 2021 19:45:33 +0800 Subject: [PATCH] torrents list imdb rating --- include/functions.php | 10 +- lang/chs/lang_functions.php | 4 + lang/cht/lang_functions.php | 4 + lang/en/lang_functions.php | 4 + nexus/Imdb/Imdb.php | 124 ++++++++++++++++--- nexus/Imdb/ImdbException.php | 8 ++ nexus/PTGen/PTGen.php | 26 ++++ public/details.php | 234 ++++++----------------------------- public/pic/douban2.png | Bin 0 -> 1793 bytes public/pic/imdb2.png | Bin 0 -> 2164 bytes public/retriver.php | 8 +- public/torrents.php | 11 +- 12 files changed, 210 insertions(+), 223 deletions(-) create mode 100644 nexus/Imdb/ImdbException.php create mode 100644 public/pic/douban2.png create mode 100644 public/pic/imdb2.png diff --git a/include/functions.php b/include/functions.php index f436563a..258e74a3 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2982,6 +2982,12 @@ function torrenttable($res, $variant = "torrent") { global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak; global $CURLANGDIR; + $setting = get_setting('main'); + $enablePtGen = $setting['enable_pt_gen_system'] == 'yes'; + if ($enablePtGen) { + $ptGen = new Nexus\PTGen\PTGen(); + } + if ($variant == "torrent"){ $last_browse = $CURUSER['last_browse']; $sectiontype = $browsecatmode; @@ -3178,7 +3184,9 @@ while ($row = mysql_fetch_assoc($res)) print($dissmall_descr == "" ? "" : "
".htmlspecialchars($dissmall_descr)); } print(""); - + if ($enablePtGen && !empty($row['pt_gen'])) { + echo $ptGen->renderTorrentsPageAverageRating(json_decode($row['pt_gen'], true)); + } $act = ""; if ($CURUSER["dlicon"] != 'no' && $CURUSER["downloadpos"] != "no") $act .= "\"download\"" ; diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php index b14a425d..004d1f63 100644 --- a/lang/chs/lang_functions.php +++ b/lang/chs/lang_functions.php @@ -294,6 +294,10 @@ $lang_functions = array 'text_pt_gen_imdb_url_note' => "(来自 imdb 的链接。如电影 Transformers 的链接是 https://www.imdb.com/title/tt0418279/)", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 链接", 'text_pt_gen_bangumi_url_note' => "(来自 bangumi 的链接。如动画 星际牛仔 的链接是 https://bangumi.tv/subject/253/)", + '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 图片目录不可写', ); ?> diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php index 28bccdad..97ef88d8 100644 --- a/lang/cht/lang_functions.php +++ b/lang/cht/lang_functions.php @@ -293,6 +293,10 @@ $lang_functions = array 'text_pt_gen_imdb_url_note' => "(來自 imdb 的鏈接。如電影 Transformers 的鏈接是 https://www.imdb.com/title/tt0418279/)", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi 鏈接", 'text_pt_gen_bangumi_url_note' => "(來自 bangumi 的鏈接。如動畫 星際牛仔 的鏈接是 https://bangumi.tv/subject/253/)", + '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 圖片目錄不可寫', ); ?> diff --git a/lang/en/lang_functions.php b/lang/en/lang_functions.php index fba7efab..298edd88 100644 --- a/lang/en/lang_functions.php +++ b/lang/en/lang_functions.php @@ -294,6 +294,10 @@ $lang_functions = array 'text_pt_gen_imdb_url_note' => "(URL taken from imdb. e.g. for movie Transformers the URL is https://www.imdb.com/title/tt0418279/)", 'row_pt_gen_bangumi_url' => "PT-Gen bangumi link", 'text_pt_gen_bangumi_url_note' => "(URL taken from bangumi. e.g. for animation Cowboy Bebop the URL is https://bangumi.tv/subject/253/)", + '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', ); ?> diff --git a/nexus/Imdb/Imdb.php b/nexus/Imdb/Imdb.php index 421c20d2..ac40c9b4 100644 --- a/nexus/Imdb/Imdb.php +++ b/nexus/Imdb/Imdb.php @@ -9,18 +9,112 @@ class Imdb { private $config; + private $movie; + + private $pages = array('Title', 'Credits', 'Amazon', 'Goofs', 'Plot', 'Comments', 'Quotes', 'Taglines', 'Plotoutline', 'Trivia', 'Directed'); + public function __construct() { $config = new Config(); - $config->cachedir = ROOT_PATH . 'imdb/cache'; - $config->photodir = ROOT_PATH . 'imdb/pic_imdb'; - $config->photoroot = 'pic_imdb'; + $cacheDir = ROOT_PATH . 'imdb/cache/'; + $photoRoot = 'images/'; + $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; } + 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) { - $movie = new Title($imdbId, $this->config); + global $lang_details; + $movie = $this->getMovie($imdbId); + $thenumbers = $imdbId; $country = $movie->country (); $director = $movie->director(); $creator = $movie->creator(); // For TV series @@ -32,12 +126,7 @@ class Imdb $compose = $movie->composer(); $gen = $movie->genres(); //$comment = $movie->comment(); - $similiar_movies = $movie->similiar_movies(); - - if (($photo_url = $movie->photo_localurl() ) != FALSE) - $smallth = "\"poster\""; - else - $smallth = "\"no"; +// $similiar_movies = $movie->similiar_movies(); $autodata = 'https://www.imdb.com/title/tt'.$thenumbers."
------------------------------------------------------------------------------------------------------------------------------------
\n"; $autodata .= "".$lang_details['text_information']."
\n"; @@ -48,11 +137,10 @@ class Imdb $temp = ""; foreach ($movie->alsoknow() as $ak) { -// $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", "; - $temp .= $ak["title"] . ", "; + $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", "; } $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 .= "
\n".$lang_details['text_year']."" . "".$movie->year ()."
\n"; $autodata .= "".$lang_details['text_runtime']."".$runtimes."
\n"; $autodata .= "".$lang_details['text_votes']."" . "".$movie->votes ()."
\n"; @@ -139,12 +227,14 @@ class Imdb for ($i = 0; $i < count ($cast); $i++) { -// if ($i > 9) -// { -// break; -// } + if ($i > 9) + { + break; + } $autodata .= ". " . "" . $cast[$i]["name"] . " " .$lang_details['text_as']."" . "".$cast[$i]["role"]."" . "
\n"; } + return $autodata; + } } \ No newline at end of file diff --git a/nexus/Imdb/ImdbException.php b/nexus/Imdb/ImdbException.php new file mode 100644 index 00000000..085a619d --- /dev/null +++ b/nexus/Imdb/ImdbException.php @@ -0,0 +1,8 @@ + [ 'url_pattern' => '/(?:https?:\/\/)?(?:www\.)?imdb\.com\/title\/(tt\d+)\/?/', 'home_page' => 'https://www.imdb.com/', + 'rating_average_img' => 'pic/imdb2.png', ], self::SITE_DOUBAN => [ 'url_pattern' => '/(?:https?:\/\/)?(?:(?:movie|www)\.)?douban\.com\/(?:subject|movie)\/(\d+)\/?/', 'home_page' => 'https://www.douban.com/', + 'rating_average_img' => 'pic/douban2.png', ], self::SITE_BANGUMI => [ 'url_pattern' => '/(?:https?:\/\/)?(?:bgm\.tv|bangumi\.tv|chii\.in)\/subject\/(\d+)\/?/', 'home_page' => 'https://bangumi.tv/', + 'rating_average_img' => 'pic/douban2.png', ], ]; @@ -205,4 +208,27 @@ HTML; } return ['json_arr' => $jsonArr, 'html' => $html, 'update' => $update]; } + + public function renderTorrentsPageAverageRating(array $ptGenData) + { + $result = '
'; + $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( + '
%s%s
', + $info['rating_average_img'], $site, $site, $rating + ); + $count++; + } + $result .= '
'; + return $result; + } } \ No newline at end of file diff --git a/public/details.php b/public/details.php index 87097f75..ba87d303 100644 --- a/public/details.php +++ b/public/details.php @@ -3,10 +3,7 @@ ob_start(); //Do not delete this line require_once("../include/bittorrent.php"); dbconn(); require_once(get_langfile_path()); -if ($showextinfo['imdb'] == 'yes') - require_once("imdb/imdb.class.php"); loggedinorreturn(); - $id = intval($_GET["id"] ?? 0); int_check($id); @@ -30,6 +27,12 @@ else { $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"])) { stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\""); @@ -132,14 +135,11 @@ else { print("
"); } $moviename = ""; - $imdb_id = parse_imdb_id($row["url"]); if ($imdb_id && $showextinfo['imdb'] == 'yes') { $thenumbers = $imdb_id; if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){ - $movie = new imdb ($thenumbers); - $target = array('Title'); - switch ($movie->cachestate($target)){ + switch ($imdb->getCacheStatus($imdb_id, 'Title')){ case "1":{ $moviename = $movie->title (); break; $Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000); @@ -172,205 +172,49 @@ else { $Cache->new_page('imdb_id_'.$thenumbers.'_large', 1296000, true); if (!$Cache->get_page()){ - $movie = new imdb ($thenumbers); - $movieid = $thenumbers; - $movie->setid ($movieid); - $target = array('Title', 'Credits', 'Plot'); - switch ($movie->cachestate($target)) + switch ($imdb->getCacheStatus($imdb_id, 'Title')) { 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']."".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1); else - tr($lang_details['text_imdb'] . $lang_details['row_info'] , "\"\"       " . $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'] , "\"\"       " . $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; } case "1" : { reset_cachetimestamp($row['id']); - $country = $movie->country (); - $director = $movie->director(); - $creator = $movie->creator(); // For TV series - $write = $movie->writing(); - $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) + $smallth = "\"poster\""; + else + $smallth = "\"no"; - if (($photo_url = $movie->photo_localurl() ) != FALSE) - $smallth = "\"poster\""; - else - $smallth = "\"no"; - - $autodata = 'https://www.imdb.com/title/tt'.$thenumbers."
------------------------------------------------------------------------------------------------------------------------------------
\n"; - $autodata .= "".$lang_details['text_information']."
\n"; - $autodata .= "------------------------------------------------------------------------------------------------------------------------------------

\n"; - $autodata .= "". $lang_details['text_title']."" . "".$movie->title ()."
\n"; - $autodata .= "".$lang_details['text_also_known_as'].""; - - $temp = ""; - foreach ($movie->alsoknow() as $ak) - { -// $temp .= $ak["title"].$ak["year"]. ($ak["country"] != "" ? " (".$ak["country"].")" : "") . ($ak["comment"] != "" ? " (" . $ak["comment"] . ")" : "") . ", "; - $temp .= $ak["title"] . ", "; - } - $autodata .= rtrim(trim($temp), ","); - $runtimes = str_replace(" min",$lang_details['text_mins'], $movie->runtime_all()); - $autodata .= "
\n".$lang_details['text_year']."" . "".$movie->year ()."
\n"; - $autodata .= "".$lang_details['text_runtime']."".$runtimes."
\n"; - $autodata .= "".$lang_details['text_votes']."" . "".$movie->votes ()."
\n"; - $autodata .= "".$lang_details['text_rating']."" . "".$movie->rating ()."
\n"; - $autodata .= "".$lang_details['text_language']."" . "".$movie->language ()."
\n"; - $autodata .= "".$lang_details['text_country'].""; - - $temp = ""; - for ($i = 0; $i < count ($country); $i++) - { - $temp .="$country[$i], "; - } - $autodata .= rtrim(trim($temp), ","); - - $autodata .= "
\n".$lang_details['text_all_genres'].""; - $temp = ""; - for ($i = 0; $i < count($gen); $i++) - { - $temp .= "$gen[$i], "; - } - $autodata .= rtrim(trim($temp), ","); - - $autodata .= "
\n".$lang_details['text_tagline']."" . "".$movie->tagline ()."
\n"; - if ($director){ - $autodata .= "".$lang_details['text_director'].""; - $temp = ""; - for ($i = 0; $i < count ($director); $i++) - { - $temp .= "" . $director[$i]["name"] . ", "; - } - $autodata .= rtrim(trim($temp), ","); - } - elseif ($creator) - $autodata .= "".$lang_details['text_creator']."".$creator; - - $autodata .= "
\n".$lang_details['text_written_by'].""; - $temp = ""; - for ($i = 0; $i < count ($write); $i++) - { - $temp .= "" . "".$write[$i]["name"]."" . ", "; - } - $autodata .= rtrim(trim($temp), ","); - - $autodata .= "
\n".$lang_details['text_produced_by'].""; - $temp = ""; - for ($i = 0; $i < count ($produce); $i++) - { - $temp .= "" . "".$produce[$i]["name"]."" . ", "; - } - $autodata .= rtrim(trim($temp), ","); - - $autodata .= "
\n".$lang_details['text_music'].""; - $temp = ""; - for ($i = 0; $i < count($compose); $i++) - { - $temp .= "" . "".$compose[$i]["name"]."" . ", "; - } - $autodata .= rtrim(trim($temp), ","); - - $autodata .= "

\n\n------------------------------------------------------------------------------------------------------------------------------------
\n"; - $autodata .= "".$lang_details['text_plot_outline']."
\n"; - $autodata .= "------------------------------------------------------------------------------------------------------------------------------------
"; - -// if(count($plot) == 0) -// { -// $autodata .= "
\n".$plot_outline; -// } -// else -// { -// for ($i = 0; $i < count ($plot); $i++) -// { -// $autodata .= "
\n. "; -// $autodata .= $plot[$i]; -// } -// } - if (!empty($plot_outline)) { - $autodata .= "
\n".$plot_outline; - } - - - $autodata .= "

\n\n------------------------------------------------------------------------------------------------------------------------------------
\n"; - $autodata .= "".$lang_details['text_cast']."
\n"; - $autodata .= "------------------------------------------------------------------------------------------------------------------------------------

\n"; - - for ($i = 0; $i < count ($cast); $i++) - { -// if ($i > 9) -// { -// break; -// } - $autodata .= ". " . "" . $cast[$i]["name"] . " " .$lang_details['text_as']."" . "".$cast[$i]["role"]."" . "
\n"; - } - - - /*$autodata .= "
------------------------------------------------------------------------------------------------------------------------------------
\n"; - $autodata .= "".$lang_details['text_may_also_like']."
\n"; - $autodata .= "------------------------------------------------------------------------------------------------------------------------------------

\n"; - - $autodata .= ""; - 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 = "" . $lang_details['text_local_link'] . ""; - } - } - - $autodata .= ($counter == 5 ? "" : "" ) . ""; - $counter++; - } - } - $autodata .= "
protocol_prefix . $movie->imdbsite . $similiar_movies_each['Link'] . "\" title=\"\">\""
" . $similiar_movies_each['Name'] . "

" . ($on_site != "" ? $on_site : " ") . "
";*/ - - //$autodata .= "
\n\n------------------------------------------------------------------------------------------------------------------------------------
\n"; - //$autodata .= "".$lang_details['text_recommended_comment']."
\n"; - //$autodata .= "------------------------------------------------------------------------------------------------------------------------------------
"; - - //$autodata .= "
".$comment; - $cache_time = $movie->getcachetime(); - - $Cache->add_whole_row(); - print(""); - print("\"Show/Hide\" ".$lang_details['text_imdb'] . $lang_details['row_info'] ."
". $smallth."
"); - $Cache->end_whole_row(); - $Cache->add_row(); - $Cache->add_part(); - print("
".$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']."".$lang_details['text_here_to_update']); - $Cache->end_part(); - $Cache->end_row(); - $Cache->add_whole_row(); - print("
"); - $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; + $autodata = $imdb->renderDetailsPageDescription($row['id'], $imdb_id); + $cache_time = $imdb->getCachedAt($imdb_id, 'Title'); + $Cache->add_whole_row(); + print(""); + print("\"Show/Hide\" ".$lang_details['text_imdb'] . $lang_details['row_info'] ."
". $smallth."
"); + $Cache->end_whole_row(); + $Cache->add_row(); + $Cache->add_part(); + print("
".$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']."".$lang_details['text_here_to_update']); + $Cache->end_part(); + $Cache->end_row(); + $Cache->add_whole_row(); + print("
"); + $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" : { diff --git a/public/pic/douban2.png b/public/pic/douban2.png new file mode 100644 index 0000000000000000000000000000000000000000..e67b44242de561a59b47164a854cbf5e689dba95 GIT binary patch literal 1793 zcmaJ?do)ye93MN8Y-WYcV`HzWPL!FsGt4lPNoFoanQ4+dV&$5-m}TaUnTzpgO{h)M zo@{zp%TXwiN845#mC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f)GtMRO| zz{Cgm?57;t&1=?ZjP|=9S4$kMqo2g01?eI8iUzKpOUeS1A10kI2)5#G+%x4T*7L07M>A3WC3iWd2ID+jnR(K7xzm~uh$x4(zp7b z69VtJ@+l>z4j zz9;yOa1G~SWr5Qqo=uk6aQEG1Ag^Ltpb{S=t$Fbqhqh=fuvgn#)k@Q~;hLURzQkve zZnQh*0e}5ncWI11ZFa~18Y$EM{g)c|`VTkzoeSmr2R5pEgZakiH=vHu3nUyf(iwFR-*Jb= zXuqOCul3Yvjs7CaxYubhrJ)~eAa#{%+)ut&>Bf3?nmfM!+aM2WY77xVd*e*Wjjlx1+|33;9O+ zlP8Iuj9Q>O<;J=bpVCF!b;L^Xa7PrB{L#)h$AZ++lZnA1F_2u;vx6?v*JVyLtniJ7~MON46y*R%!WDF<3N) z)pbE<*cw94FhS^n^8#)=Gq8NO@n)Vs3h2_}N@-g^E=NxSIWRx}2 zM}wKw0z2Gba}Anc0azfKiG^%S6uLgIV_3gf_w>{7wAuHym|1-XKC{wAHfL*$t~5MV z?dyJ_4@}NQ%4^zp$pXWjjc(usK9@0u;u`jalb#N!Q3O`&rdIc|{cL`SdV-)c5+@vH z<^_%pG}kZXS~70%Ju1L3WC47S=BVhB(>1|)YYjuxA32TG+H<+qC)_~ujwSvzYt#9+ zD|6Y_2G{>yl$yoL7&u{7P%SqFwY_Lk6^j&p6hbu4=8ZmuuceA}Lt`i16(TAo_!dAllC q9KLFm`r$Xx^ndW*ZJIDE&;4K4QMB$(=`pqd0000getMovie($imdb_id); $movieid = $thenumbers; - $movie->setid ($movieid); $target = array('Title', 'Credits', 'Plot'); - ($type == 2 ? $movie->purge_single(true) : ""); + ($type == 2 ? $imdb->purgeSingle($imdb_id) : ""); set_cachetimestamp($id,"cache_stamp"); - $movie->preparecache($target,true); $Cache->delete_value('imdb_id_'.$thenumbers.'_movie_name'); $Cache->delete_value('imdb_id_'.$thenumbers.'_large', true); $Cache->delete_value('imdb_id_'.$thenumbers.'_median', true); diff --git a/public/torrents.php b/public/torrents.php index c895bc83..7c7883b0 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -4,8 +4,10 @@ dbconn(true); require_once(get_langfile_path("torrents.php")); loggedinorreturn(); parked(); -if ($showextinfo['imdb'] == 'yes') - require_once ("imdb/imdb.class.php"); +if ($showextinfo['imdb'] == 'yes') { + $imdb = new \Nexus\Imdb\Imdb(); +} + //check searchbox $sectiontype = $browsecatmode; $showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not @@ -40,7 +42,6 @@ $column = ''; $ascdesc = ''; if (isset($_GET['sort']) && $_GET['sort'] && isset($_GET['type']) && $_GET['type']) { - switch($_GET['sort']) { case '1': $column = "name"; break; case '2': $column = "numfiles"; break; @@ -858,10 +859,10 @@ if ($count) list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam); 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{ - $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());