mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 01:38:54 +00:00
2db9954e8a
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
29 lines
902 B
PHP
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";
|
|
}
|