Move colorcli class to helpers

This commit is contained in:
DariusIII
2025-12-26 23:48:37 +01:00
parent ed202f0f9e
commit f50875550d
90 changed files with 1129 additions and 1296 deletions
+5 -5
View File
@@ -6,12 +6,12 @@ require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
use App\Models\Category;
use App\Services\ConsoleService;
use Blacklight\ColorCLI;
use Illuminate\Support\Facades\DB;
$pdo = DB::connection()->getPdo();
$console = new ConsoleService;
$colorCli = new ColorCLI;
$res = $pdo->query(
sprintf(
@@ -22,7 +22,7 @@ $res = $pdo->query(
)
);
if ($res instanceof Traversable) {
$colorCli->header('Updating console info for '.number_format($res->rowCount()).' releases.');
cli()->header('Updating console info for '.number_format($res->rowCount()).' releases.');
foreach ($res as $arr) {
$starttime = now()->timestamp;
@@ -30,14 +30,14 @@ if ($res instanceof Traversable) {
if ($gameInfo !== false) {
$game = $console->updateConsoleInfo($gameInfo);
if ($game === false) {
$colorCli->primary($gameInfo['release'].' not found');
cli()->primary($gameInfo['release'].' not found');
}
}
// amazon limits are 1 per 1 sec
$diff = floor((now()->timestamp - $starttime) * 1000000);
if (1000000 - $diff > 0) {
$colorCli->alternate('Sleeping');
cli()->alternate('Sleeping');
usleep(1000000 - $diff);
}
}