Files
newznab-tmux/lib/testing/PostProc/getMovieCovers.php
T
Scrutinizer Auto-Fixer 2db9954e8a Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-03-24 11:56:32 +00:00

29 lines
902 B
PHP

<?php
//This script will update all records in the movieinfo table where there is no cover
require_once(dirname(__FILE__) . "/../../../bin/config.php");
require_once(WWW_DIR . "/lib/framework/db.php");
require_once(NN_TMUX . 'lib' . DS . 'Film.php');
$pdo = new DB();
$movie = new \Film(array('Echo' => true, 'Settings' => $pdo));
$movies = $pdo->queryDirect("SELECT imdbid FROM movieinfo WHERE cover = 0 ORDER BY year ASC, id DESC");
if ($movies instanceof \Traversable) {
echo $pdo->log->primary("Updating " . number_format($movies->rowCount()) . " movie covers.");
foreach ($movies as $mov) {
$starttime = microtime(true);
$mov = $movie->updateMovieInfo($mov['imdbid']);
// tmdb limits are 30 per 10 sec, not certain for imdb
$diff = floor((microtime(true) - $starttime) * 1000000);
if (333333 - $diff > 0) {
echo "\nsleeping\n";
usleep(333333 - $diff);
}
}
echo "\n";
}