@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * Track when we received a 429 error and need to pause. |
| 47 | 47 | * Format: ['timestamp' => int, 'paused_until' => int] |
| 48 | 48 | */ |
| 49 | - private static ?array $rateLimitPause = null; |
|
| 49 | + private static ? array $rateLimitPause = null; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @throws \Exception |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $response = $this->makeGraphQLRequest($query, $variables); |
| 165 | 165 | |
| 166 | - if ($response === false || ! isset($response['data']['Page']['media'])) { |
|
| 166 | + if ($response === false || !isset($response['data']['Page']['media'])) { |
|
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | // Get anilist_id from database |
| 184 | 184 | $anidbInfo = AnidbInfo::query()->where('anidbid', $anidbid)->first(); |
| 185 | 185 | |
| 186 | - if (! $anidbInfo || ! $anidbInfo->anilist_id) { |
|
| 186 | + if (!$anidbInfo || !$anidbInfo->anilist_id) { |
|
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | $response = $this->makeGraphQLRequest($query, $variables); |
| 279 | 279 | |
| 280 | - if ($response === false || ! isset($response['data']['Media'])) { |
|
| 280 | + if ($response === false || !isset($response['data']['Media'])) { |
|
| 281 | 281 | return false; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // Throw exception to stop processing |
| 308 | - throw new \Exception("AniList API rate limit exceeded (429). Paused until " . date('Y-m-d H:i:s', $pausedUntil)); |
|
| 308 | + throw new \Exception("AniList API rate limit exceeded (429). Paused until ".date('Y-m-d H:i:s', $pausedUntil)); |
|
| 309 | 309 | } else { |
| 310 | 310 | // Pause period expired, clear it |
| 311 | 311 | self::$rateLimitPause = null; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | ]; |
| 354 | 354 | |
| 355 | 355 | // Clean old entries (older than 1 minute) |
| 356 | - $this->rateLimitQueue = array_filter($this->rateLimitQueue, function ($entry) { |
|
| 356 | + $this->rateLimitQueue = array_filter($this->rateLimitQueue, function($entry) { |
|
| 357 | 357 | return $entry['timestamp'] > (time() - 60); |
| 358 | 358 | }); |
| 359 | 359 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | cli()->error('AniList API returned 429 (Too Many Requests). Pausing all API calls for 15 minutes.'); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - throw new \Exception("AniList API rate limit exceeded (429). Paused until " . date('Y-m-d H:i:s', $pauseUntil)); |
|
| 387 | + throw new \Exception("AniList API rate limit exceeded (429). Paused until ".date('Y-m-d H:i:s', $pauseUntil)); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | if ($this->echooutput) { |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | private function enforceRateLimit(): void |
| 410 | 410 | { |
| 411 | 411 | // Count requests in the last minute |
| 412 | - $recentRequests = array_filter($this->rateLimitQueue, function ($entry) { |
|
| 412 | + $recentRequests = array_filter($this->rateLimitQueue, function($entry) { |
|
| 413 | 413 | return $entry['timestamp'] > (time() - 60); |
| 414 | 414 | }); |
| 415 | 415 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | // If we're approaching the limit, wait |
| 419 | 419 | if ($requestCount >= (self::RATE_LIMIT_PER_MINUTE - 5)) { |
| 420 | 420 | // Wait until the oldest request is more than 1 minute old |
| 421 | - if (! empty($this->rateLimitQueue)) { |
|
| 421 | + if (!empty($this->rateLimitQueue)) { |
|
| 422 | 422 | $oldestRequest = min(array_column($this->rateLimitQueue, 'timestamp')); |
| 423 | 423 | $waitTime = 60 - (time() - $oldestRequest) + 1; |
| 424 | 424 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $description = $anilistData['description'] ?? ''; |
| 484 | 484 | // Remove HTML tags from description |
| 485 | 485 | $description = strip_tags($description); |
| 486 | - $description = html_entity_decode($description, ENT_QUOTES | ENT_HTML5, 'UTF-8'); |
|
| 486 | + $description = html_entity_decode($description, ENT_QUOTES|ENT_HTML5, 'UTF-8'); |
|
| 487 | 487 | |
| 488 | 488 | $rating = isset($anilistData['averageScore']) ? (string) $anilistData['averageScore'] : null; |
| 489 | 489 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | $creators = ''; |
| 501 | 501 | if (isset($anilistData['studios']['nodes']) && is_array($anilistData['studios']['nodes'])) { |
| 502 | - $studioNames = array_map(function ($studio) { |
|
| 502 | + $studioNames = array_map(function($studio) { |
|
| 503 | 503 | return $studio['name'] ?? ''; |
| 504 | 504 | }, $anilistData['studios']['nodes']); |
| 505 | 505 | $creators = implode(', ', array_filter($studioNames)); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | $characters = ''; |
| 509 | 509 | if (isset($anilistData['characters']['nodes']) && is_array($anilistData['characters']['nodes'])) { |
| 510 | - $characterNames = array_map(function ($character) { |
|
| 510 | + $characterNames = array_map(function($character) { |
|
| 511 | 511 | return $character['name']['full'] ?? ''; |
| 512 | 512 | }, array_slice($anilistData['characters']['nodes'], 0, 10)); // Limit to 10 characters |
| 513 | 513 | $characters = implode(', ', array_filter($characterNames)); |
@@ -603,18 +603,18 @@ discard block |
||
| 603 | 603 | ); |
| 604 | 604 | |
| 605 | 605 | // Insert titles |
| 606 | - if (isset($anilistData['title']['romaji']) && ! empty($anilistData['title']['romaji'])) { |
|
| 606 | + if (isset($anilistData['title']['romaji']) && !empty($anilistData['title']['romaji'])) { |
|
| 607 | 607 | $this->insertAniListTitle($anidbid, 'main', 'x-jat', $anilistData['title']['romaji']); |
| 608 | 608 | } |
| 609 | - if (isset($anilistData['title']['english']) && ! empty($anilistData['title']['english'])) { |
|
| 609 | + if (isset($anilistData['title']['english']) && !empty($anilistData['title']['english'])) { |
|
| 610 | 610 | $this->insertAniListTitle($anidbid, 'official', 'en', $anilistData['title']['english']); |
| 611 | 611 | } |
| 612 | - if (isset($anilistData['title']['native']) && ! empty($anilistData['title']['native'])) { |
|
| 612 | + if (isset($anilistData['title']['native']) && !empty($anilistData['title']['native'])) { |
|
| 613 | 613 | $this->insertAniListTitle($anidbid, 'main', 'ja', $anilistData['title']['native']); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | // Download cover image if available |
| 617 | - if (! empty($picture) && isset($anilistData['coverImage']['large'])) { |
|
| 617 | + if (!empty($picture) && isset($anilistData['coverImage']['large'])) { |
|
| 618 | 618 | $this->downloadCoverImage($anidbid, $anilistData['coverImage']['large']); |
| 619 | 619 | } |
| 620 | 620 | } |
@@ -635,8 +635,8 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | try { |
| 637 | 637 | // Ensure directory exists with proper permissions |
| 638 | - if (! is_dir($this->imgSavePath)) { |
|
| 639 | - if (! mkdir($this->imgSavePath, 0755, true) && ! is_dir($this->imgSavePath)) { |
|
| 638 | + if (!is_dir($this->imgSavePath)) { |
|
| 639 | + if (!mkdir($this->imgSavePath, 0755, true) && !is_dir($this->imgSavePath)) { |
|
| 640 | 640 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->imgSavePath)); |
| 641 | 641 | } |
| 642 | 642 | } |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | $anidbIds = AnidbTitle::query() |
| 681 | 681 | ->selectRaw('DISTINCT anidb_titles.anidbid') |
| 682 | 682 | ->leftJoin('anidb_info as ai', 'ai.anidbid', '=', 'anidb_titles.anidbid') |
| 683 | - ->where(function ($query) { |
|
| 683 | + ->where(function($query) { |
|
| 684 | 684 | $query->whereNull('ai.anilist_id') |
| 685 | 685 | ->orWhere('ai.updated', '<', now()->subWeek()); |
| 686 | 686 | }) |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | if ($title) { |
| 698 | 698 | $searchResults = $this->searchAnime($title, 1); |
| 699 | - if ($searchResults && ! empty($searchResults)) { |
|
| 699 | + if ($searchResults && !empty($searchResults)) { |
|
| 700 | 700 | $anilistData = $searchResults[0]; |
| 701 | 701 | $this->insertAniListInfo($anidb->anidbid, $anilistData); |
| 702 | 702 | // Rate limiting is handled in makeGraphQLRequest |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | ->where('anilist_id', $anilistId) |
| 722 | 722 | ->value('anidbid'); |
| 723 | 723 | |
| 724 | - if (! $anidbid) { |
|
| 724 | + if (!$anidbid) { |
|
| 725 | 725 | // Create a new entry using anilist_id as anidbid |
| 726 | 726 | $anidbid = (int) $anilistId; |
| 727 | 727 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function releases(): void |
| 89 | 89 | { |
| 90 | - $this->runWithTiming('releases', function () { |
|
| 90 | + $this->runWithTiming('releases', function() { |
|
| 91 | 91 | $this->releasesRunner->releases(); |
| 92 | 92 | $this->processReleasesEndWork(); |
| 93 | 93 | }); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function updatePerGroup(): void |
| 100 | 100 | { |
| 101 | - $this->runWithTiming('update_per_group', function () { |
|
| 101 | + $this->runWithTiming('update_per_group', function() { |
|
| 102 | 102 | $this->releasesRunner->updatePerGroup(); |
| 103 | 103 | $this->processReleasesEndWork(); |
| 104 | 104 | }); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function processTv(bool $renamedOnly = false): void |
| 149 | 149 | { |
| 150 | - $this->runWithTiming('postProcess_tv', function () use ($renamedOnly) { |
|
| 150 | + $this->runWithTiming('postProcess_tv', function() use ($renamedOnly) { |
|
| 151 | 151 | if ($this->postProcessRunner->hasTvWork($renamedOnly)) { |
| 152 | 152 | $this->postProcessRunner->processTv($renamedOnly); |
| 153 | 153 | } else { |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | if (config('nntmux.echocli')) { |
| 218 | 218 | cli()->header( |
| 219 | - "Multi-processing for {$taskName} finished in " . (now()->timestamp - $startTime) . |
|
| 220 | - ' seconds at ' . now()->toRfc2822String() . '.' . PHP_EOL |
|
| 219 | + "Multi-processing for {$taskName} finished in ".(now()->timestamp - $startTime). |
|
| 220 | + ' seconds at '.now()->toRfc2822String().'.'.PHP_EOL |
|
| 221 | 221 | ); |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $query = DB::select( |
| 246 | 246 | sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id) |
| 247 | 247 | ); |
| 248 | - if (! empty($query)) { |
|
| 248 | + if (!empty($query)) { |
|
| 249 | 249 | $count++; |
| 250 | 250 | } |
| 251 | 251 | } catch (\PDOException $e) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | { |
| 266 | 266 | $process = Process::fromShellCommandline($command); |
| 267 | 267 | $process->setTimeout(1800); |
| 268 | - $process->run(function ($type, $buffer) { |
|
| 268 | + $process->run(function($type, $buffer) { |
|
| 269 | 269 | if ($type === Process::ERR) { |
| 270 | 270 | echo $buffer; |
| 271 | 271 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | protected function log(string $message): void |
| 281 | 281 | { |
| 282 | 282 | if (config('nntmux.echocli')) { |
| 283 | - echo $message . PHP_EOL; |
|
| 283 | + echo $message.PHP_EOL; |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ((int) $videoId > 0 && (int) $siteId > 0) { |
| 135 | - if (! empty($tvdbShow['poster'])) { |
|
| 135 | + if (!empty($tvdbShow['poster'])) { |
|
| 136 | 136 | $this->getPoster($videoId); |
| 137 | 137 | } elseif ($this->fanart->isConfigured()) { |
| 138 | 138 | $posterUrl = $this->fanart->getBestTvPoster($siteId); |
| 139 | - if (! empty($posterUrl)) { |
|
| 139 | + if (!empty($posterUrl)) { |
|
| 140 | 140 | $this->posterUrl = $posterUrl; |
| 141 | 141 | $this->getPoster($videoId); |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $seriesNo = (! empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : ''); |
|
| 146 | - $episodeNo = (! empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : ''); |
|
| 147 | - $hasAirdate = ! empty($release['airdate']); |
|
| 145 | + $seriesNo = (!empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : ''); |
|
| 146 | + $episodeNo = (!empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : ''); |
|
| 147 | + $hasAirdate = !empty($release['airdate']); |
|
| 148 | 148 | |
| 149 | 149 | if ($episodeNo === 'all') { |
| 150 | 150 | $this->setVideoIdFound($videoId, $row['id'], 0); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | continue; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if (! $this->countEpsByVideoID($videoId)) { |
|
| 161 | + if (!$this->countEpsByVideoID($videoId)) { |
|
| 162 | 162 | $this->getEpisodeInfo($siteId, -1, -1, $videoId); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $highest = $show; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if (! empty($show->aliases)) { |
|
| 288 | + if (!empty($show->aliases)) { |
|
| 289 | 289 | foreach ($show->aliases as $akaIndex => $akaName) { |
| 290 | 290 | $aliasPercent = $this->checkMatch(strtolower($akaName), strtolower($name), self::MATCH_PROBABILITY); |
| 291 | 291 | if ($aliasPercent > $highestMatch) { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | - if (! empty($highest)) { |
|
| 299 | + if (!empty($highest)) { |
|
| 300 | 300 | $return = $this->formatShowInfo($highest); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $ri = new ReleaseImageService; |
| 310 | 310 | $hasCover = 0; |
| 311 | 311 | |
| 312 | - if (! empty($this->posterUrl)) { |
|
| 312 | + if (!empty($this->posterUrl)) { |
|
| 313 | 313 | $hasCover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath); |
| 314 | 314 | if ($hasCover === 1) { |
| 315 | 315 | $this->setCoverFound($videoId); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | { |
| 329 | 329 | $return = $response = false; |
| 330 | 330 | |
| 331 | - if (! $this->local) { |
|
| 331 | + if (!$this->local) { |
|
| 332 | 332 | if ($videoId > 0) { |
| 333 | 333 | try { |
| 334 | 334 | $response = $this->client->series()->allEpisodes($siteId); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | try { |
| 381 | 381 | $poster = $this->client->series()->artworks($show->tvdb_id); |
| 382 | 382 | $poster = collect($poster)->where('type', 2)->sortByDesc('score')->first(); |
| 383 | - $this->posterUrl = ! empty($poster->image) ? $poster->image : ''; |
|
| 383 | + $this->posterUrl = !empty($poster->image) ? $poster->image : ''; |
|
| 384 | 384 | } catch (ResourceNotFoundException $e) { |
| 385 | 385 | cli()->error('Poster image not found on TVDB'); |
| 386 | 386 | } catch (UnauthorizedException $error) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | 'tvrage' => 0, |
| 415 | 415 | 'tvmaze' => 0, |
| 416 | 416 | 'tmdb' => 0, |
| 417 | - 'aliases' => ! empty($show->aliases) ? $show->aliases : '', |
|
| 417 | + 'aliases' => !empty($show->aliases) ? $show->aliases : '', |
|
| 418 | 418 | 'localzone' => "''", |
| 419 | 419 | ]; |
| 420 | 420 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // Found a matching show in local DB |
| 47 | 47 | $episodeId = false; |
| 48 | 48 | $hasEpisodeNumbers = isset($showInfo['season'], $showInfo['episode']) && $showInfo['episode'] !== 'all' && (int) $showInfo['season'] > 0 && (int) $showInfo['episode'] > 0; |
| 49 | - $hasAirdate = ! empty($showInfo['airdate']); |
|
| 49 | + $hasAirdate = !empty($showInfo['airdate']); |
|
| 50 | 50 | |
| 51 | 51 | if ($hasEpisodeNumbers || $hasAirdate) { |
| 52 | 52 | // Try to find the specific episode |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! $matched && $videoId === false || $videoId === 0) { |
|
| 114 | + if (!$matched && $videoId === false || $videoId === 0) { |
|
| 115 | 115 | $notFoundCount++; |
| 116 | 116 | if ($this->echooutput) { |
| 117 | 117 | cli()->primaryOver(' → '); |
| 118 | 118 | cli()->alternateOver($showInfo['cleanname']); |
| 119 | - if (! empty($showInfo['airdate'])) { |
|
| 119 | + if (!empty($showInfo['airdate'])) { |
|
| 120 | 120 | cli()->primaryOver(' | '); |
| 121 | 121 | cli()->warningOver($showInfo['airdate']); |
| 122 | 122 | } elseif (isset($showInfo['season'], $showInfo['episode'])) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Skip if we don't have valid parsed info |
| 36 | - if (! $passable->hasValidParsedInfo()) { |
|
| 36 | + if (!$passable->hasValidParsedInfo()) { |
|
| 37 | 37 | return $next($passable); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return $title; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return mb_substr($title, 0, $maxLength - 3) . '...'; |
|
| 131 | + return mb_substr($title, 0, $maxLength - 3).'...'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | protected function outputMatch(string $title, ?int $season = null, ?int $episode = null, ?string $airdate = null): void |
| 138 | 138 | { |
| 139 | - if (! $this->echoOutput) { |
|
| 139 | + if (!$this->echoOutput) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | cli()->primaryOver(' ✓ '); |
| 157 | - cli()->primary('MATCHED (' . $this->getName() . ')'); |
|
| 157 | + cli()->primary('MATCHED ('.$this->getName().')'); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | protected function outputNotFound(string $title): void |
| 164 | 164 | { |
| 165 | - if (! $this->echoOutput) { |
|
| 165 | + if (!$this->echoOutput) { |
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | cli()->primaryOver(' → '); |
| 170 | 170 | cli()->alternateOver($this->truncateTitle($title)); |
| 171 | 171 | cli()->primaryOver(' → '); |
| 172 | - cli()->alternate('Not found in ' . $this->getName()); |
|
| 172 | + cli()->alternate('Not found in '.$this->getName()); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | protected function outputSkipped(string $title): void |
| 179 | 179 | { |
| 180 | - if (! $this->echoOutput) { |
|
| 180 | + if (!$this->echoOutput) { |
|
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function outputSearching(string $title): void |
| 194 | 194 | { |
| 195 | - if (! $this->echoOutput) { |
|
| 195 | + if (!$this->echoOutput) { |
|
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | cli()->primaryOver(' → '); |
| 200 | 200 | cli()->headerOver($this->truncateTitle($title)); |
| 201 | 201 | cli()->primaryOver(' → '); |
| 202 | - cli()->info('Searching ' . $this->getName() . '...'); |
|
| 202 | + cli()->info('Searching '.$this->getName().'...'); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function outputFoundInDb(string $title): void |
| 209 | 209 | { |
| 210 | - if (! $this->echoOutput) { |
|
| 210 | + if (!$this->echoOutput) { |
|
| 211 | 211 | return; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $this->imageService = $imageService ?? new ReleaseImageService; |
| 73 | 73 | |
| 74 | 74 | $this->gameQty = Settings::settingValue('maxgamesprocessed') !== '' ? (int) Settings::settingValue('maxgamesprocessed') : 150; |
| 75 | - $this->imgSavePath = config('nntmux_settings.covers_path') . '/games/'; |
|
| 75 | + $this->imgSavePath = config('nntmux_settings.covers_path').'/games/'; |
|
| 76 | 76 | $this->renamed = (int) Settings::settingValue('lookupgames') === 2 ? 'AND isrenamed = 1' : ''; |
| 77 | 77 | $this->matchPercentage = 60; |
| 78 | 78 | $this->maxHitRequest = false; |
| 79 | - $this->catWhere = 'AND categories_id = ' . Category::PC_GAMES . ' '; |
|
| 79 | + $this->catWhere = 'AND categories_id = '.Category::PC_GAMES.' '; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // ======================================== |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ->join('genres as g', 'gi.genres_id', '=', 'g.id'); |
| 145 | 145 | |
| 146 | 146 | if (!empty($search)) { |
| 147 | - $query->where('gi.title', 'like', '%' . $search . '%'); |
|
| 147 | + $query->where('gi.title', 'like', '%'.$search.'%'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $query->orderByDesc('created_at') |
@@ -179,27 +179,27 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | $exccatlist = ''; |
| 181 | 181 | if (count($excludedCats) > 0) { |
| 182 | - $exccatlist = ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')'; |
|
| 182 | + $exccatlist = ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')'; |
|
| 183 | 183 | } |
| 184 | 184 | $order = $this->getGamesOrder($orderBy); |
| 185 | 185 | $gamesSql = |
| 186 | 186 | "SELECT SQL_CALC_FOUND_ROWS gi.id, GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id FROM gamesinfo gi LEFT JOIN releases r ON gi.id = r.gamesinfo_id WHERE gi.title != '' AND gi.cover = 1 AND r.passwordstatus " |
| 187 | - . app(\App\Services\Releases\ReleaseBrowseService::class)->showPasswords() . |
|
| 188 | - $browseBy . |
|
| 189 | - $catsrch . |
|
| 190 | - $maxAge . |
|
| 191 | - $exccatlist . |
|
| 192 | - ' GROUP BY gi.id ORDER BY ' . ($order[0]) . ' ' . ($order[1]) . |
|
| 193 | - ($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start); |
|
| 187 | + . app(\App\Services\Releases\ReleaseBrowseService::class)->showPasswords(). |
|
| 188 | + $browseBy. |
|
| 189 | + $catsrch. |
|
| 190 | + $maxAge. |
|
| 191 | + $exccatlist. |
|
| 192 | + ' GROUP BY gi.id ORDER BY '.($order[0]).' '.($order[1]). |
|
| 193 | + ($start === false ? '' : ' LIMIT '.$num.' OFFSET '.$start); |
|
| 194 | 194 | |
| 195 | 195 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
| 196 | - $gamesCache = Cache::get(md5($gamesSql . $page)); |
|
| 196 | + $gamesCache = Cache::get(md5($gamesSql.$page)); |
|
| 197 | 197 | if ($gamesCache !== null) { |
| 198 | 198 | $games = $gamesCache; |
| 199 | 199 | } else { |
| 200 | 200 | $data = DB::select($gamesSql); |
| 201 | 201 | $games = ['total' => DB::select('SELECT FOUND_ROWS() AS total'), 'result' => $data]; |
| 202 | - Cache::put(md5($gamesSql . $page), $games, $expiresAt); |
|
| 202 | + Cache::put(md5($gamesSql.$page), $games, $expiresAt); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $gameIDs = $releaseIDs = false; |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $returnSql = |
| 214 | - 'SELECT r.id, r.rarinnerfilecount, r.grabs, r.comments, r.totalpart, r.size, r.postdate, r.searchname, r.haspreview, r.passwordstatus, r.guid, g.name AS group_name, df.failed AS failed, gi.*, YEAR (gi.releasedate) as year, r.gamesinfo_id, rn.releases_id AS nfoid FROM releases r LEFT OUTER JOIN usenet_groups g ON g.id = r.groups_id LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id INNER JOIN gamesinfo gi ON gi.id = r.gamesinfo_id WHERE gi.id IN (' . (is_array($gameIDs) ? implode(',', $gameIDs) : -1) . ') AND r.id IN (' . (is_array($releaseIDs) ? implode(',', $releaseIDs) : -1) . ')' . $catsrch . ' GROUP BY gi.id ORDER BY ' . ($order[0]) . ' ' . ($order[1]); |
|
| 214 | + 'SELECT r.id, r.rarinnerfilecount, r.grabs, r.comments, r.totalpart, r.size, r.postdate, r.searchname, r.haspreview, r.passwordstatus, r.guid, g.name AS group_name, df.failed AS failed, gi.*, YEAR (gi.releasedate) as year, r.gamesinfo_id, rn.releases_id AS nfoid FROM releases r LEFT OUTER JOIN usenet_groups g ON g.id = r.groups_id LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id INNER JOIN gamesinfo gi ON gi.id = r.gamesinfo_id WHERE gi.id IN ('.(is_array($gameIDs) ? implode(',', $gameIDs) : -1).') AND r.id IN ('.(is_array($releaseIDs) ? implode(',', $releaseIDs) : -1).')'.$catsrch.' GROUP BY gi.id ORDER BY '.($order[0]).' '.($order[1]); |
|
| 215 | 215 | |
| 216 | - $return = Cache::get(md5($returnSql . $page)); |
|
| 216 | + $return = Cache::get(md5($returnSql.$page)); |
|
| 217 | 217 | if ($return !== null) { |
| 218 | 218 | return $return; |
| 219 | 219 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if (count($return) > 0) { |
| 222 | 222 | $return[0]->_totalcount = $games['total'][0]->total ?? 0; |
| 223 | 223 | } |
| 224 | - Cache::put(md5($returnSql . $page), $return, $expiresAt); |
|
| 224 | + Cache::put(md5($returnSql.$page), $return, $expiresAt); |
|
| 225 | 225 | |
| 226 | 226 | return $return; |
| 227 | 227 | } |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | if (!empty($_REQUEST[$bbk])) { |
| 278 | 278 | $bbs = stripslashes($_REQUEST[$bbk]); |
| 279 | 279 | if ($bbk === 'year') { |
| 280 | - $browseBy .= ' AND YEAR (gi.releasedate) ' . 'LIKE ' . escapeString('%' . $bbs . '%'); |
|
| 280 | + $browseBy .= ' AND YEAR (gi.releasedate) '.'LIKE '.escapeString('%'.$bbs.'%'); |
|
| 281 | 281 | } else { |
| 282 | - $browseBy .= ' AND gi.' . $bbv . ' ' . 'LIKE ' . escapeString('%' . $bbs . '%'); |
|
| 282 | + $browseBy .= ' AND gi.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%'); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -538,10 +538,10 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | if (!empty($gamesId)) { |
| 540 | 540 | if ($this->echoOutput) { |
| 541 | - cli()->header('Added/updated game: ') . |
|
| 542 | - cli()->alternateOver(' Title: ') . |
|
| 543 | - cli()->primary($game['title']) . |
|
| 544 | - cli()->alternateOver(' Source: ') . |
|
| 541 | + cli()->header('Added/updated game: '). |
|
| 542 | + cli()->alternateOver(' Title: '). |
|
| 543 | + cli()->primary($game['title']). |
|
| 544 | + cli()->alternateOver(' Source: '). |
|
| 545 | 545 | cli()->primary($this->_classUsed); |
| 546 | 546 | } |
| 547 | 547 | |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | // Save backdrop image |
| 554 | 554 | if ($game['backdrop'] === 1 && isset($game['backdropurl'])) { |
| 555 | - $game['backdrop'] = $this->imageService->saveImage($gamesId . '-backdrop', $game['backdropurl'], $this->imgSavePath, 1920, 1024); |
|
| 555 | + $game['backdrop'] = $this->imageService->saveImage($gamesId.'-backdrop', $game['backdropurl'], $this->imgSavePath, 1920, 1024); |
|
| 556 | 556 | } |
| 557 | 557 | } elseif ($this->echoOutput) { |
| 558 | - cli()->headerOver('Nothing to update: ') . |
|
| 559 | - cli()->primary($game['title'] . ' (PC)'); |
|
| 558 | + cli()->headerOver('Nothing to update: '). |
|
| 559 | + cli()->primary($game['title'].' (PC)'); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | return $gamesId !== false ? $gamesId : false; |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | |
| 624 | 624 | if ($res->count() > 0) { |
| 625 | 625 | if ($this->echoOutput) { |
| 626 | - cli()->header('Processing ' . $res->count() . ' games release(s).'); |
|
| 626 | + cli()->header('Processing '.$res->count().' games release(s).'); |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | Log::info('GamesService: Starting processing', ['count' => $res->count()]); |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | |
| 639 | 639 | if ($gameInfo !== false) { |
| 640 | 640 | if ($this->echoOutput) { |
| 641 | - cli()->info('Looking up: ' . $gameInfo['title'] . ' (PC)'); |
|
| 641 | + cli()->info('Looking up: '.$gameInfo['title'].' (PC)'); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | // Check for existing games entry |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->asstag = Settings::settingValue('amazonassociatetag'); |
| 69 | 69 | $this->gameQty = (Settings::settingValue('maxgamesprocessed') !== '') ? (int) Settings::settingValue('maxgamesprocessed') : 150; |
| 70 | 70 | $this->sleepTime = (Settings::settingValue('amazonsleep') !== '') ? (int) Settings::settingValue('amazonsleep') : 1000; |
| 71 | - $this->imgSavePath = config('nntmux_settings.covers_path') . '/console/'; |
|
| 71 | + $this->imgSavePath = config('nntmux_settings.covers_path').'/console/'; |
|
| 72 | 72 | $this->renamed = (int) Settings::settingValue('lookupgames') === 2; |
| 73 | 73 | |
| 74 | 74 | $this->failCache = []; |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | foreach (explode(' ', $title) as $word) { |
| 105 | 105 | $word = trim(rtrim(trim($word), '-')); |
| 106 | 106 | if ($word !== '' && $word !== '-') { |
| 107 | - $word = '+' . $word; |
|
| 107 | + $word = '+'.$word; |
|
| 108 | 108 | $searchWords .= sprintf('%s ', $word); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | - $searchWords = trim($searchWords . '+' . $platform); |
|
| 111 | + $searchWords = trim($searchWords.'+'.$platform); |
|
| 112 | 112 | |
| 113 | 113 | return ConsoleInfo::search($searchWords)->first() ?? false; |
| 114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | $exccatlist = ''; |
| 136 | 136 | if (\count($excludedCats) > 0) { |
| 137 | - $exccatlist = ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')'; |
|
| 137 | + $exccatlist = ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')'; |
|
| 138 | 138 | } |
| 139 | 139 | $order = $this->getConsoleOrder($orderBy); |
| 140 | 140 | $calcSql = sprintf( |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | $exccatlist, |
| 157 | 157 | $order[0], |
| 158 | 158 | $order[1], |
| 159 | - ($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start) |
|
| 159 | + ($start === false ? '' : ' LIMIT '.$num.' OFFSET '.$start) |
|
| 160 | 160 | ); |
| 161 | 161 | |
| 162 | - $cached = Cache::get(md5($calcSql . $page)); |
|
| 162 | + $cached = Cache::get(md5($calcSql.$page)); |
|
| 163 | 163 | if ($cached !== null) { |
| 164 | 164 | $consoles = $cached; |
| 165 | 165 | } else { |
| 166 | 166 | $data = DB::select($calcSql); |
| 167 | 167 | $consoles = ['total' => DB::select('SELECT FOUND_ROWS() AS total'), 'result' => $data]; |
| 168 | 168 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
| 169 | - Cache::put(md5($calcSql . $page), $consoles, $expiresAt); |
|
| 169 | + Cache::put(md5($calcSql.$page), $consoles, $expiresAt); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $consoleIDs = $releaseIDs = false; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $order[1] |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $return = Cache::get(md5($sql . $page)); |
|
| 207 | + $return = Cache::get(md5($sql.$page)); |
|
| 208 | 208 | if ($return !== null) { |
| 209 | 209 | return $return; |
| 210 | 210 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_long')); |
| 218 | - Cache::put(md5($sql . $page), $return, $expiresAt); |
|
| 218 | + Cache::put(md5($sql.$page), $return, $expiresAt); |
|
| 219 | 219 | |
| 220 | 220 | return $return; |
| 221 | 221 | } |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | { |
| 277 | 277 | $browseBy = ' '; |
| 278 | 278 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
| 279 | - if (! empty($_REQUEST[$bbk])) { |
|
| 279 | + if (!empty($_REQUEST[$bbk])) { |
|
| 280 | 280 | $bbs = stripslashes($_REQUEST[$bbk]); |
| 281 | - $browseBy .= ' AND con.' . $bbv . ' LIKE ' . escapeString('%' . $bbs . '%'); |
|
| 281 | + $browseBy .= ' AND con.'.$bbv.' LIKE '.escapeString('%'.$bbs.'%'); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -352,12 +352,12 @@ discard block |
||
| 352 | 352 | $consoleId = $this->updateConsoleTable($igdb); |
| 353 | 353 | |
| 354 | 354 | if ($this->echoOutput && $consoleId !== -2) { |
| 355 | - cli()->header('Added/updated game: ') . |
|
| 356 | - cli()->alternateOver(' Title: ') . |
|
| 357 | - cli()->primary($igdb['title']) . |
|
| 358 | - cli()->alternateOver(' Platform: ') . |
|
| 359 | - cli()->primary($igdb['platform']) . |
|
| 360 | - cli()->alternateOver(' Genre: ') . |
|
| 355 | + cli()->header('Added/updated game: '). |
|
| 356 | + cli()->alternateOver(' Title: '). |
|
| 357 | + cli()->primary($igdb['title']). |
|
| 358 | + cli()->alternateOver(' Platform: '). |
|
| 359 | + cli()->primary($igdb['platform']). |
|
| 360 | + cli()->alternateOver(' Genre: '). |
|
| 361 | 361 | cli()->primary($igdb['consolegenre']); |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | if (config('config.credentials.client_id') !== '' && config('config.credentials.client_secret') !== '') { |
| 380 | 380 | try { |
| 381 | 381 | $result = Game::where('name', $gameInfo)->get(); |
| 382 | - if (! empty($result)) { |
|
| 382 | + if (!empty($result)) { |
|
| 383 | 383 | $bestMatchPct = 0; |
| 384 | 384 | foreach ($result as $res) { |
| 385 | 385 | similar_text(strtolower($gameInfo), strtolower($res->name), $percent); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | ])->where('id', $bestMatch)->first(); |
| 399 | 399 | |
| 400 | 400 | $publishers = []; |
| 401 | - if (! empty($game->involved_companies)) { |
|
| 401 | + if (!empty($game->involved_companies)) { |
|
| 402 | 402 | foreach ($game->involved_companies as $publisher) { |
| 403 | 403 | if ($publisher['publisher'] === true) { |
| 404 | 404 | $company = Company::find($publisher['company']); |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | $genres = []; |
| 411 | - if (! empty($game->themes)) { |
|
| 411 | + if (!empty($game->themes)) { |
|
| 412 | 412 | foreach ($game->themes as $theme) { |
| 413 | 413 | $genres[] = $theme['name']; |
| 414 | 414 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $genreKey = $this->getGenreKey(implode(',', $genres)); |
| 418 | 418 | |
| 419 | 419 | $platform = ''; |
| 420 | - if (! empty($game->platforms)) { |
|
| 420 | + if (!empty($game->platforms)) { |
|
| 421 | 421 | foreach ($game->platforms as $platforms) { |
| 422 | 422 | $percentCurrent = 0; |
| 423 | 423 | $gamePlatforms = Platform::where('id', $platforms)->get(); |
@@ -436,13 +436,13 @@ discard block |
||
| 436 | 436 | 'title' => $game->name, |
| 437 | 437 | 'asin' => $game->id, |
| 438 | 438 | 'review' => $game->summary ?? '', |
| 439 | - 'coverurl' => ! empty($game->cover->url) ? 'https:' . $game->cover->url : '', |
|
| 440 | - 'releasedate' => ! empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
| 441 | - 'esrb' => ! empty($game->aggregated_rating) ? round($game->aggregated_rating) . '%' : 'Not Rated', |
|
| 439 | + 'coverurl' => !empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
| 440 | + 'releasedate' => !empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
| 441 | + 'esrb' => !empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
| 442 | 442 | 'url' => $game->url ?? '', |
| 443 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
| 443 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
| 444 | 444 | 'platform' => $platform ?? '', |
| 445 | - 'consolegenre' => ! empty($genres) ? implode(',', $genres) : 'Unknown', |
|
| 445 | + 'consolegenre' => !empty($genres) ? implode(',', $genres) : 'Unknown', |
|
| 446 | 446 | 'consolegenreid' => $genreKey ?? '', |
| 447 | 447 | 'salesrank' => '', |
| 448 | 448 | ]; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $this->igdbSleep = now()->endOfMonth(); |
| 462 | 462 | } |
| 463 | 463 | } catch (\Exception $e) { |
| 464 | - cli()->error('Error fetching IGDB properties: ' . $e->getMessage()); |
|
| 464 | + cli()->error('Error fetching IGDB properties: '.$e->getMessage()); |
|
| 465 | 465 | |
| 466 | 466 | return false; |
| 467 | 467 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $releaseCount = $res->count(); |
| 496 | 496 | if ($res instanceof \Traversable && $releaseCount > 0) { |
| 497 | 497 | if ($this->echoOutput) { |
| 498 | - cli()->header('Processing ' . $releaseCount . ' console release(s).'); |
|
| 498 | + cli()->header('Processing '.$releaseCount.' console release(s).'); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | foreach ($res as $arr) { |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | if ($gameInfo !== false) { |
| 508 | 508 | if ($this->echoOutput) { |
| 509 | - cli()->info('Looking up: ' . $gameInfo['title'] . ' (' . $gameInfo['platform'] . ')'); |
|
| 509 | + cli()->info('Looking up: '.$gameInfo['title'].' ('.$gameInfo['platform'].')'); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | // Check for existing console entry. |
| 513 | 513 | $gameCheck = $this->getConsoleInfoByName($gameInfo['title'], $gameInfo['platform']); |
| 514 | 514 | |
| 515 | - if ($gameCheck === false && \in_array($gameInfo['title'] . $gameInfo['platform'], $this->failCache, false)) { |
|
| 515 | + if ($gameCheck === false && \in_array($gameInfo['title'].$gameInfo['platform'], $this->failCache, false)) { |
|
| 516 | 516 | // Lookup recently failed, no point trying again |
| 517 | 517 | if ($this->echoOutput) { |
| 518 | 518 | cli()->info('Cached previous failure. Skipping.'); |
@@ -523,11 +523,11 @@ discard block |
||
| 523 | 523 | $usedAmazon = true; |
| 524 | 524 | if ($gameId === null) { |
| 525 | 525 | $gameId = -2; |
| 526 | - $this->failCache[] = $gameInfo['title'] . $gameInfo['platform']; |
|
| 526 | + $this->failCache[] = $gameInfo['title'].$gameInfo['platform']; |
|
| 527 | 527 | } |
| 528 | 528 | } else { |
| 529 | 529 | if ($this->echoOutput) { |
| 530 | - cli()->headerOver('Found Local: ') . |
|
| 530 | + cli()->headerOver('Found Local: '). |
|
| 531 | 531 | cli()->primary("{$gameInfo['title']} - {$gameInfo['platform']}"); |
| 532 | 532 | } |
| 533 | 533 | $gameId = $gameCheck['id'] ?? -2; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | $platform = 'PSX'; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | - if (! empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
| 607 | + if (!empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
| 608 | 608 | $platform = 'XBOX360'; |
| 609 | 609 | } |
| 610 | 610 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $result['release'] = $releaseName; |
| 617 | 617 | array_map('trim', $result); |
| 618 | 618 | |
| 619 | - return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; |
|
| 619 | + return (isset($result['title'], $result['platform']) && !empty($result['title'])) ? $result : false; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | // ======================================== |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $process = Process::fromShellCommandline($command); |
| 133 | 133 | $process->setTimeout(1800); |
| 134 | - $process->run(function ($type, $buffer) { |
|
| 134 | + $process->run(function($type, $buffer) { |
|
| 135 | 135 | if ($type === Process::ERR) { |
| 136 | 136 | echo $buffer; |
| 137 | 137 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $running = []; |
| 175 | 175 | $queue = $tasks; |
| 176 | 176 | |
| 177 | - $startNext = function () use (&$queue, &$running, $timeout): ?string { |
|
| 177 | + $startNext = function() use (&$queue, &$running, $timeout): ?string { |
|
| 178 | 178 | if (empty($queue)) { |
| 179 | 179 | return null; |
| 180 | 180 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | try { |
| 199 | 199 | $results[$key] = $callable(); |
| 200 | 200 | } catch (\Throwable $e) { |
| 201 | - \Log::error("Task {$key} failed: " . $e->getMessage()); |
|
| 201 | + \Log::error("Task {$key} failed: ".$e->getMessage()); |
|
| 202 | 202 | $results[$key] = ''; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | try { |
| 228 | 228 | $results[$key] = $callable(); |
| 229 | 229 | } catch (\Throwable $e) { |
| 230 | - \Log::error("Task {$key} failed: " . $e->getMessage()); |
|
| 230 | + \Log::error("Task {$key} failed: ".$e->getMessage()); |
|
| 231 | 231 | $results[$key] = ''; |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $running = []; |
| 253 | 253 | $queue = $commands; |
| 254 | 254 | |
| 255 | - $startNext = function () use (&$queue, &$running, $timeout) { |
|
| 255 | + $startNext = function() use (&$queue, &$running, $timeout) { |
|
| 256 | 256 | if (empty($queue)) { |
| 257 | 257 | return; |
| 258 | 258 | } |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $this->headerStart('postprocess: '.$desc, $total, $maxProcesses); |
| 311 | 311 | |
| 312 | - $startNext = function () use (&$queue, &$running, &$started) { |
|
| 312 | + $startNext = function() use (&$queue, &$running, &$started) { |
|
| 313 | 313 | if (empty($queue)) { |
| 314 | 314 | return; |
| 315 | 315 | } |
| 316 | 316 | $cmd = array_shift($queue); |
| 317 | 317 | $proc = Process::fromShellCommandline($cmd); |
| 318 | 318 | $proc->setTimeout((int) config('nntmux.multiprocessing_max_child_time', 1800)); |
| 319 | - $proc->start(function ($type, $buffer) { |
|
| 319 | + $proc->start(function($type, $buffer) { |
|
| 320 | 320 | // Stream both STDOUT and STDERR |
| 321 | 321 | echo $buffer; |
| 322 | 322 | }); |
@@ -325,14 +325,14 @@ discard block |
||
| 325 | 325 | }; |
| 326 | 326 | |
| 327 | 327 | // Prime initial processes |
| 328 | - for ($i = 0; $i < $maxProcesses && ! empty($queue); $i++) { |
|
| 328 | + for ($i = 0; $i < $maxProcesses && !empty($queue); $i++) { |
|
| 329 | 329 | $startNext(); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Event loop |
| 333 | - while (! empty($running)) { |
|
| 333 | + while (!empty($running)) { |
|
| 334 | 334 | foreach ($running as $key => $proc) { |
| 335 | - if (! $proc->isRunning()) { |
|
| 335 | + if (!$proc->isRunning()) { |
|
| 336 | 336 | // Print any remaining buffered output |
| 337 | 337 | $out = $proc->getIncrementalOutput(); |
| 338 | 338 | $err = $proc->getIncrementalErrorOutput(); |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | cli()->primary('Finished task #'.($total - $finished + 1).' for '.$desc); |
| 349 | 349 | } |
| 350 | 350 | // Start next from queue if available |
| 351 | - if (! empty($queue)) { |
|
| 351 | + if (!empty($queue)) { |
|
| 352 | 352 | $startNext(); |
| 353 | 353 | } |
| 354 | 354 | } |
@@ -210,21 +210,21 @@ |
||
| 210 | 210 | |
| 211 | 211 | cli()->primary('Release Information:'); |
| 212 | 212 | |
| 213 | - echo ' ' . cli()->headerOver('New name: ') . cli()->primary(substr($newName, 0, 100)) . PHP_EOL; |
|
| 214 | - echo ' ' . cli()->headerOver('Old name: ') . cli()->primary(substr((string) $release->searchname, 0, 100)) . PHP_EOL; |
|
| 215 | - echo ' ' . cli()->headerOver('Use name: ') . cli()->primary(substr((string) $release->name, 0, 100)) . PHP_EOL; |
|
| 213 | + echo ' '.cli()->headerOver('New name: ').cli()->primary(substr($newName, 0, 100)).PHP_EOL; |
|
| 214 | + echo ' '.cli()->headerOver('Old name: ').cli()->primary(substr((string) $release->searchname, 0, 100)).PHP_EOL; |
|
| 215 | + echo ' '.cli()->headerOver('Use name: ').cli()->primary(substr((string) $release->name, 0, 100)).PHP_EOL; |
|
| 216 | 216 | echo PHP_EOL; |
| 217 | 217 | |
| 218 | - echo ' ' . cli()->headerOver('New cat: ') . cli()->primary($newCatName) . PHP_EOL; |
|
| 219 | - echo ' ' . cli()->headerOver('Old cat: ') . cli()->primary($oldCatName) . PHP_EOL; |
|
| 220 | - echo ' ' . cli()->headerOver('Group: ') . cli()->primary($groupName) . PHP_EOL; |
|
| 218 | + echo ' '.cli()->headerOver('New cat: ').cli()->primary($newCatName).PHP_EOL; |
|
| 219 | + echo ' '.cli()->headerOver('Old cat: ').cli()->primary($oldCatName).PHP_EOL; |
|
| 220 | + echo ' '.cli()->headerOver('Group: ').cli()->primary($groupName).PHP_EOL; |
|
| 221 | 221 | echo PHP_EOL; |
| 222 | 222 | |
| 223 | - echo ' ' . cli()->headerOver('Method: ') . cli()->primary($type . $method) . PHP_EOL; |
|
| 224 | - echo ' ' . cli()->headerOver('Release ID: ') . cli()->primary((string) $release->releases_id) . PHP_EOL; |
|
| 223 | + echo ' '.cli()->headerOver('Method: ').cli()->primary($type.$method).PHP_EOL; |
|
| 224 | + echo ' '.cli()->headerOver('Release ID: ').cli()->primary((string) $release->releases_id).PHP_EOL; |
|
| 225 | 225 | |
| 226 | 226 | if (!empty($release->filename)) { |
| 227 | - echo ' ' . cli()->headerOver('Filename: ') . cli()->primary(substr((string) $release->filename, 0, 100)) . PHP_EOL; |
|
| 227 | + echo ' '.cli()->headerOver('Filename: ').cli()->primary(substr((string) $release->filename, 0, 100)).PHP_EOL; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ($type !== 'PAR2, ') { |