mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 09:18:54 +00:00
89ce5002ff
(cherry picked from commit 2ec8b9e)
26 lines
827 B
PHP
26 lines
827 B
PHP
<?php
|
|
//This script will update all records in the movieinfo table where there is no cover
|
|
require_once dirname(__FILE__) . '/../../../www/config.php';
|
|
|
|
use newznab\db\Settings;
|
|
|
|
$pdo = new Settings();
|
|
|
|
$movie = new Movie(['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";
|
|
} |