Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Visual correction
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklul committed Apr 2, 2020
1 parent a2294b7 commit bb8142f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ private function apiRequest($tags, $page = 1, $limit = 1, $retry = true)
if ($retry) {
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code === 429) {
print "\r";
return $this->applyCooldown(
1,
['error' => 'ShortLimitReached'],
Expand Down Expand Up @@ -1255,10 +1256,10 @@ private function readImage($file, $type)
*/
private function applyCooldown($delay = 60, array $results, callable $callable)
{
$this->printout("\r" . $this->LINE_BUFFER);
$this->printout($this->LINE_BUFFER);
$this->parseError(is_array($results) ? $results['error'] : null);

$this->printout(' Waiting ' . $delay . ' seconds for limit to expire...');
$this->printout(' Waiting ' . $delay . ' seconds...');
sleep($delay);

return $callable();
Expand Down Expand Up @@ -1478,7 +1479,7 @@ private function cURLProgress($resource = null, $download_size = 0, $downloaded
}

if ($total > 0) {
print(str_repeat(' ', strlen($this->LINE_BUFFER) + 25) . "\r" . $this->LINE_BUFFER . ' ' . round(($progress * 100) / $total, 0)) . "% \r";
print(str_repeat(' ', strlen($this->LINE_BUFFER) + 15) . "\r" . $this->LINE_BUFFER . ' ' . round(($progress * 100) / $total, 0)) . "% \r";
}

usleep(100);
Expand Down

0 comments on commit bb8142f

Please # to comment.