mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Move colorcli class to helpers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user