diff --git a/Changelog b/Changelog index bf15de323..7fc9dabc9 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-07-19 DariusIII + * Chg: Update getXXXSamples script * Chg: Remove Blacklight\db\DB class from many scripts in misc/testing folder * Chg: Update ReleaseExtra class constructor * Chg: Remove Blacklight\db\DB from ProcessAdditional class diff --git a/misc/testing/PostProc/getXXXSamples.php b/misc/testing/PostProc/getXXXSamples.php index d897c3450..07b008674 100644 --- a/misc/testing/PostProc/getXXXSamples.php +++ b/misc/testing/PostProc/getXXXSamples.php @@ -2,11 +2,11 @@ require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; -use Blacklight\db\DB; use App\Models\Category; +use Blacklight\ColorCLI; use Blacklight\ReleaseImage; -$pdo = new DB(); +$pdo = DB::getPdo(); $path2cover = NN_COVERS.'samples'.DS; @@ -18,7 +18,7 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { $limit = $argv[2]; } - echo $pdo->log->header('Scanning for XXX UHD/HD/SD releases missing sample images'); + echo ColorCLI::header('Scanning for XXX UHD/HD/SD releases missing sample images'); $res = $pdo->query(sprintf('SELECT r.id, r.guid AS guid, r.searchname AS searchname FROM releases r WHERE r.nzbstatus = 1 AND r.jpgstatus = 0 AND r.categories_id IN (%s, %s, %s) ORDER BY r.adddate DESC', Category::XXX_CLIPHD, Category::XXX_CLIPSD, Category::XXX_UHD)); @@ -29,17 +29,17 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { if ($argv[1] === 'true') { $imgpath = 'http://pic4all.eu/images/'.$row['searchname'].'_1.jpg'; //scan pic4all.eu for sample image - if (preg_match('/SDCLiP/i', $row['searchname'])) { + if (stripos($row['searchname'], 'SDCLiP') !== false) { $row['searchname'] = strtolower(preg_replace('/.XXX(.720p|.1080p)?.MP4-SDCLiP/i', '', $row['searchname'])); $imgpath = 'http://pic4all.eu/images/'.$row['searchname'].'.jpg'; } $sample = $releaseImage->saveImage($row['guid'].'_thumb', $imgpath, $releaseImage->jpgSavePath, 650, 650); if ($sample !== 0) { - echo $pdo->log->info('Downloaded sample for '.$row['searchname']); - $pdo->queryExec(sprintf('UPDATE releases SET jpgstatus = 1 WHERE id = %d', $row['id'])); + echo ColorCLI::info('Downloaded sample for '.$row['searchname']); + $pdo->exec(sprintf('UPDATE releases SET jpgstatus = 1 WHERE id = %d', $row['id'])); } else { - echo $pdo->log->notice('Sample download failed!'); - $pdo->queryExec(sprintf('UPDATE releases SET jpgstatus = -2 WHERE id = %d', $row['id'])); + echo ColorCLI::notice('Sample download failed!'); + $pdo->exec(sprintf('UPDATE releases SET jpgstatus = -2 WHERE id = %d', $row['id'])); } } } @@ -48,9 +48,9 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { break; } } - echo $pdo->log->header('Total releases missing samples that '.$couldbe.'their samples updated = '.number_format($counterfixed)); + echo ColorCLI::header('Total releases missing samples that '.$couldbe.'their samples updated = '.number_format($counterfixed)); } else { - exit($pdo->log->header("\nThis script checks if XXX release samples actually exist on disk.\n\n" + exit(ColorCLI::header("\nThis script checks if XXX release samples actually exist on disk.\n\n" ."php $argv[0] check ...: Dry run, displays missing samples.\n" ."php $argv[0] true ...: Update XXX releases missing samples.\n")); }