diff --git a/Changelog b/Changelog index 5acced276..4d9302d5c 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-08-08 DariusIII + * Chg: Update misc/testing/PostProc/getImdb.php script * Chg: Update Steam class * Fix: Use proper type casting in groupfixrelnames (Fixes issue #159) 2017-08-07 DariusIII diff --git a/misc/testing/PostProc/getImdb.php b/misc/testing/PostProc/getImdb.php index 03723d440..512030247 100644 --- a/misc/testing/PostProc/getImdb.php +++ b/misc/testing/PostProc/getImdb.php @@ -7,24 +7,27 @@ use nntmux\ColorCLI; use nntmux\Movie; $pdo = new DB(); -$c = new ColorCLI(); $movie = new Movie(['Echo' => true, 'Settings' => $pdo]); -$movies = $pdo->queryDirect("SELECT imdbid FROM movieinfo WHERE tmdbid = 0 ORDER BY id ASC"); +$movies = $pdo->queryDirect('SELECT imdbid FROM movieinfo WHERE tmdbid = 0 ORDER BY id ASC'); if ($movies instanceof \Traversable) { - echo $pdo->log->header("Updating movie info for " . number_format($movies->rowCount()) . " movies."); + $count = $movies->rowCount(); + if ($count > 0) { + echo ColorCLI::header('Updating movie info for ' . number_format($count) . ' movies.'); - foreach ($movies as $mov) { - $starttime = microtime(true); - $mov = $movie->updateMovieInfo($mov['imdbid']); + 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 "sleeping\n"; - usleep(333333 - $diff); + // tmdb limits are 30 per 10 sec, not certain for imdb + $diff = floor((microtime(true) - $startTime) * 1000000); + if (333333 - $diff > 0) { + echo "sleeping\n"; + usleep(333333 - $diff); + } } + } else { + echo ColorCLI::header('No movies to update'); } - echo "\n"; }