本文整理汇总了PHP中Movie::fetchImdbProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::fetchImdbProperties方法的具体用法?PHP Movie::fetchImdbProperties怎么用?PHP Movie::fetchImdbProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::fetchImdbProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Performing parsing.
*/
public function process()
{
// Default query for both full db and last 4 hours.
$sql = "SELECT r.searchname, r.name, r.fromname, r.id as rid, r.categoryid, r.guid, r.postdate,\n\t\t\t rn.id as nfoid,\n\t\t\t g.name as groupname,\n\t\t\t GROUP_CONCAT(rf.name) as filenames\n\t\tFROM releases r\n\t\tLEFT JOIN releasenfo rn ON (rn.releaseid = r.id)\n\t\tLEFT JOIN groups g ON (g.id = r.groupid)\n\t\tLEFT JOIN releasefiles rf ON (rf.releaseid = r.id)\n\t\tWHERE r.categoryid in (' . Category::CAT_TV_OTHER . ',' . Category::CAT_MOVIE_OTHER . ',' . Category::CAT_MISC_OTHER . ',' . Category::CAT_XXX_OTHER . ')\n\t\t%s\n\t\tGROUP BY r.id";
$res = $this->pdo->query(sprintf($sql, $this->limited ? "AND r.adddate BETWEEN NOW() - INTERVAL 4 HOUR AND NOW()" : ""));
$this->releasestocheck = sizeof($res);
if ($res) {
echo "PostPrc : Parsing last " . $this->releasestocheck . " releases in the Other-Misc categories\n";
foreach ($res as $rel) {
$tempname = $foundName = $methodused = '';
//Knoc.One
if (preg_match("/KNOC.ONE/i", $rel['name'])) {
$title = '';
$items = preg_split("/(\\.| )/", $rel['name']);
foreach ($items as $value) {
if (preg_match("/^[a-z]+\$/i", $value)) {
$len = strlen($value);
if ($len > 2) {
$title .= substr($value, -2) . substr($value, 0, -2) . " ";
} elseif ($len = 2) {
$title .= substr($value, -1) . substr($value, 0, -1) . " ";
} else {
$title .= $value . " ";
}
} else {
$title .= $value . " ";
}
}
$foundName = $title;
$methodused = "Knoc.One";
$this->determineCategory($rel, $foundName, $methodused);
}
///
///Use the Nfo to try to get the proper Releasename.
///
$nfo = $this->pdo->queryOneRow(sprintf("select uncompress(nfo) as nfo from releasenfo where releaseid = %d", $rel['rid']));
if ($nfo && $foundName == "") {
$this->nfosprocessed++;
$nfo = $nfo['nfo'];
//LOUNGE releases
if (preg_match('/([a-z0-9.]+\\.MBLURAY)/i', $nfo, $matches)) {
$foundName = $matches[1];
$methodused = "LOUNGE";
$this->determineCategory($rel, $foundName, $methodused);
}
//AsianDVDClub releases
if (preg_match('/adc-[a-z0-9]{1,10}/', $rel['name'])) {
if (preg_match('/.*\\(\\d{4}\\).*/i', $nfo, $matches)) {
$foundName = $matches[0];
$methodused = "AsianDVDClub";
$this->determineCategory($rel, $foundName, $methodused);
}
}
//ACOUSTiC releases
if (preg_match('/ACOUSTiC presents \\.\\.\\..*?([a-z0-9].*?\\(.*?\\))/is', $nfo, $matches)) {
$foundName = $matches[1] . ".MBLURAY";
$methodused = "ACOUSTiC ";
$this->determineCategory($rel, $foundName, $methodused);
}
//Japhson releases
if (preg_match('/Japhson/i', $nfo, $matches)) {
$movie = new Movie();
$imdbID = null;
if (preg_match('/tt(\\d{7})/i', $nfo, $matches)) {
$imdbId = $matches[1];
$movCheck = $movie->fetchImdbProperties($imdbId);
$foundName = $movCheck['title'];
if (!preg_match('/(19|20)\\d{2}/i', $foundName)) {
$foundName = $foundName . "." . $movCheck['year'];
}
if (preg_match('/language.*?\\b([a-z0-9]+)\\b/i', $nfo, $matches)) {
if (!preg_match('/English/i', $matches[1])) {
$foundName = $foundName . "." . $matches[1];
}
}
if (preg_match('/audio.*?\\b(\\w+)\\b/i', $nfo, $matches)) {
if (preg_match('/(Chinese|German|Dutch|Spanish|Hebrew|Finnish|Norwegian)/i', $matches[1])) {
$foundName = $foundName . "." . $matches[1];
}
}
if (preg_match('/(video|resolution|video res).*?(1080|720|816|820|272|1280 @|528|1920)/i', $nfo, $matches)) {
if ($matches[2] == '1280 @') {
$matches[2] = '720';
}
if ($matches[2] == '1920') {
$matches[2] = '1080';
}
$foundName = $foundName . "." . $matches[2];
}
if (preg_match('/source.*?\\b(DVD9|DVD5|BDRIP|DVD\\-?RIP|BLURAY)\\b/i', $nfo, $matches)) {
$foundName = $foundName . "." . $matches[1];
}
if (preg_match('/(video|resolution|video res).*?(XVID|X264|WMV)/i', $nfo, $matches)) {
$foundName = $foundName . "." . $matches[2];
}
if (preg_match('/audio.*?\\b(DTS|AC3)\\b/i', $nfo, $matches)) {
$foundName = $foundName . "." . $matches[1];
//.........这里部分代码省略.........
示例2: realpath
<?php
// search tmdb or web for movie from a given name
define('FS_ROOT', realpath(dirname(__FILE__)));
require_once FS_ROOT . "/../../www/config.php";
require_once FS_ROOT . "/../../www/lib/framework/db.php";
require_once FS_ROOT . "/../../www/lib/movie.php";
require_once FS_ROOT . "/../../www/lib/util.php";
$movienameorig = "A Movie Name";
$movie = new Movie();
$moviename = $movie->parseMovieName($movienameorig);
echo "Looking up " . $movienameorig . " - " . $moviename . "\n";
// #1 tmdb
//
echo "TMDB : \n";
print_r($movie->searchTmdb($moviename));
// #2 search engine (google/bing)
//$buffer = getUrl("https://www.google.com/search?source=ig&hl=en&rlz=&btnG=Google+Search&aq=f&oq=&q=".urlencode($moviename.' site:imdb.com'));
echo "\nSE : \n";
$buffer = getUrl("http://www.bing.com/search?&q=" . urlencode($moviename . ' site:imdb.com'));
if ($buffer !== false && strlen($buffer)) {
$imdb = $movie->parseImdbFromNfo($buffer);
echo sprintf("imdbid : %s\n", $imdb);
print_r($movie->fetchImdbProperties($imdb));
echo "\nTMDB:\n";
print_r($movie->fetchTmdbProperties($imdb));
}