本文整理汇总了PHP中Movie::updateMovieInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::updateMovieInfo方法的具体用法?PHP Movie::updateMovieInfo怎么用?PHP Movie::updateMovieInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::updateMovieInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AdminPage
<?php
require_once "config.php";
$page = new AdminPage();
$movie = new Movie(['Settings' => $page->settings]);
$id = 0;
$page->title = "Movie Add";
if (isset($_REQUEST['id']) && ctype_digit($_REQUEST['id']) && strlen($_REQUEST['id']) == 7) {
$id = $_REQUEST['id'];
$movCheck = $movie->getMovieInfo($id);
if (!$movCheck || isset($_REQUEST['update']) && $_REQUEST['update'] == 1) {
if ($movie->updateMovieInfo($id)) {
header("Location:" . WWW_TOP . "/movie-list.php");
die;
}
}
}
$page->content = $page->smarty->fetch('movie-add.tpl');
$page->render();
示例2: realpath
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";
$movie = new Movie(true);
$db = new Db();
$movies = array();
$counter = 1;
$sleepsecsbetweenscrape = 1;
//echo out the properties scraped from imdb for an ID
//print_r($movie->fetchImdbProperties("1375666"));
// CASE 1 - UPDATE ALL RECORDS
//$movies = $db->query("SELECT imdbID from movieinfo");
// CASE 2 - UPDATE ALL WITH A BLANK TITLE
//$movies = $db->query("SELECT imdbID from movieinfo where title = ''");
// CASE 3 - UPDATE ALL RECORDS NOT UPDATED IN THE LAST 6 MONTHS
//$movies = $db->query("SELECT imdbID from movieinfo where updateddate < DATE_ADD(NOW(), INTERVAL -6 MONTH)");
// CASE 4 - UPDATE ALL RECORDS WHERE COVER IS EMPTY
//$movies = $db->query("SELECT imdbID from movieinfo where cover = 0");
// CASE 5 - UPDATE ALL WITH NO TRAILER
//$movies = $db->query("SELECT imdbID from movieinfo where trailer is null and tmdbid is not null");
if (count($movies) == 0) {
echo "No records selected to update - either uncomment case or no matches found.\n";
die;
}
echo "Updating " . count($movies) . " records - Sleep interval " . $sleepsecsbetweenscrape . " second(s)\n";
foreach ($movies as $mov) {
echo "Updating " . $mov['imdbID'] . " (" . $counter++ . "/" . count($movies) . ")\n";
$mov = $movie->updateMovieInfo($mov['imdbID']);
sleep($sleepsecsbetweenscrape);
}
示例3: UserMovies
if (!$page->users->isLoggedIn()) {
$page->show403();
}
$um = new UserMovies(['Settings' => $page->settings]);
if (isset($_REQUEST['del'])) {
$usermovies = $um->delMovie($page->users->currentUserId(), $_REQUEST['del']);
} else {
if (isset($_REQUEST['add'])) {
// Derive cats from user preferences.
$cats = array();
$cats[] = '2030';
$cats[] = '2040';
$m = new Movie(['Settings' => $page->settings]);
$mi = $m->getMovieInfo($_REQUEST['add']);
if (!$mi) {
$m->updateMovieInfo($_REQUEST['add']);
}
$usermovies = $um->addMovie($page->users->currentUserId(), $_REQUEST['add'], $cats);
} else {
if (!isset($_REQUEST['id'])) {
$page->show404();
}
$tmdb = new TMDb($page->settings->getSetting('tmdbkey'), $page->settings->getSetting('imdblanguage'));
$m = new Movie(['Settings' => $page->settings, 'TMDb' => $tmdb]);
if (is_numeric($_REQUEST['id'])) {
$movie = $m->fetchTMDBProperties($_REQUEST['id']);
if ($movie !== false) {
$obj = array($movie);
}
} else {
$searchm = $tmdb->searchMovie($_REQUEST['id']);
示例4: UserMovies
$page->show403();
}
$um = new UserMovies();
if (isset($_REQUEST["del"])) {
$usermovies = $um->delMovie($users->currentUserId(), $_REQUEST["del"]);
} elseif (isset($_REQUEST["add"])) {
//
// derive cats from user preferences
//
$cats = array();
$cats[] = "2030";
$cats[] = "2040";
$m = new Movie(false);
$mi = $m->getMovieInfo($_REQUEST["add"]);
if (!$mi) {
$m->updateMovieInfo($_REQUEST["add"]);
}
$usermovies = $um->addMovie($users->currentUserId(), $_REQUEST["add"], $cats);
} else {
if (!isset($_REQUEST["id"])) {
$page->show404();
}
$m = new Movie(false);
if (is_numeric($_REQUEST["id"])) {
$prop = $m->fetchTmdbProperties($_REQUEST["id"]);
if ($prop !== false) {
$res = array($prop);
}
} else {
$res = $m->searchTmdb($_REQUEST["id"]);
}
示例5: processNfoFiles
public function processNfoFiles($processImdb = 1, $processTvrage = 1)
{
$ret = 0;
$db = new DB();
$nntp = new Nntp();
$res = $db->queryDirect(sprintf("SELECT rn.*, r.searchname FROM releasenfo rn left outer join releases r ON r.ID = rn.releaseID WHERE rn.nfo IS NULL AND rn.attempts < 5"));
if (mysql_num_rows($res) > 0) {
if ($this->echooutput) {
echo "Processing " . mysql_num_rows($res) . " nfos\n";
}
$nntp->doConnect();
while ($arr = mysql_fetch_assoc($res)) {
$fetchedBinary = $nntp->getBinary($arr['binaryID'], true);
if ($fetchedBinary !== false) {
//insert nfo into database
$db->query(sprintf("UPDATE releasenfo SET nfo = compress(%s) WHERE ID = %d", $db->escapeString($fetchedBinary), $arr["ID"]));
$ret++;
$imdbId = $this->parseImdb($fetchedBinary);
if ($imdbId !== false) {
//update release with imdb id
$db->query(sprintf("UPDATE releases SET imdbID = %s WHERE ID = %d", $db->escapeString($imdbId), $arr["releaseID"]));
//if set scan for imdb info
if ($processImdb == 1) {
$movie = new Movie($this->echooutput);
//check for existing movie entry
$movCheck = $movie->getMovieInfo($imdbId);
if ($movCheck === false || isset($movCheck['updateddate']) && time() - strtotime($movCheck['updateddate']) > 2592000) {
$movieId = $movie->updateMovieInfo($imdbId);
}
}
}
$rageId = $this->parseRageId($fetchedBinary);
if ($rageId !== false) {
//if set scan for tvrage info
if ($processTvrage == 1) {
$tvrage = new Tvrage($this->echooutput);
$show = $tvrage->parseNameEpSeason($arr['searchname']);
if (is_array($show) && $show['name'] != '') {
// update release with season, ep, and airdate info (if available) from releasetitle
$tvrage->updateEpInfo($show, $arr['releaseID']);
$rid = $tvrage->getByRageID($rageId);
if (!$rid) {
$tvrShow = $tvrage->getRageInfoFromService($rageId);
$tvrage->updateRageInfo($rageId, $show, $tvrShow, $arr['releaseID']);
}
}
}
}
} else {
if ($this->echooutput) {
echo "NFO download failed - release " . $arr['releaseID'] . " on attempt " . $arr["attempts"]++ . "\n";
}
//nfo download failed, increment attempts
$db->query(sprintf("UPDATE releasenfo SET attempts = attempts+1 WHERE ID = %d", $arr["ID"]));
}
if ($ret != 0 && $this->echooutput && $ret % 5 == 0) {
echo "-processed " . $ret . " nfos\n";
}
}
$nntp->doQuit();
}
//remove nfo that we cant fetch after 5 attempts
$db->query("DELETE FROM releasenfo WHERE nfo IS NULL AND attempts >= 5");
if ($this->echooutput) {
echo $ret . " nfo files processed\n";
}
return $ret;
}