@@ -34,7 +34,7 @@ |
||
| 34 | 34 | 'false', |
| 35 | 35 | ]; |
| 36 | 36 | |
| 37 | -if (! isset($argv[1], $argv[2]) || ! in_array($argv[1], $args, false) || ! in_array($argv[2], $bool, false)) { |
|
| 37 | +if (!isset($argv[1], $argv[2]) || !in_array($argv[1], $args, false) || !in_array($argv[2], $bool, false)) { |
|
| 38 | 38 | exit( |
| 39 | 39 | (new Blacklight\ColorCLI())->error( |
| 40 | 40 | "\nIncorrect arguments.\n" |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | $user = User::query()->where('email', '=', $payload['metadata']['buyerEmail'])->first(); |
| 116 | 116 | if ($user) { |
| 117 | 117 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
| 118 | - if (! empty($checkOrder)) { |
|
| 118 | + if (!empty($checkOrder)) { |
|
| 119 | 119 | Log::error('Duplicate BTCPay webhook: '.$payload['webhookId']); |
| 120 | 120 | |
| 121 | 121 | return response('Not Found', 404); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | 'airdate', |
| 94 | 94 | 'episode_title', |
| 95 | 95 | ])->first(); |
| 96 | - if (! empty($result)) { |
|
| 96 | + if (!empty($result)) { |
|
| 97 | 97 | return $result->toArray(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $this->status = self::PROC_EXTFAIL; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! empty($hits['title'])) { |
|
| 146 | + if (!empty($hits['title'])) { |
|
| 147 | 147 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | $anidbId = $this->getAnidbByName($tmpName); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 190 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 191 | 191 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
| 192 | 192 | if (empty($updatedAni)) { |
| 193 | - if (! empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
| 193 | + if (!empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
| 194 | 194 | $this->padb->populateTable('info', $anidbId->anidbid); |
| 195 | 195 | $this->doRandomSleep(); |
| 196 | 196 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function updatePreDb(array $parameters): void |
| 155 | 155 | { |
| 156 | - if (! empty($parameters)) { |
|
| 156 | + if (!empty($parameters)) { |
|
| 157 | 157 | $this->insertPredb($parameters); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -214,15 +214,15 @@ discard block |
||
| 214 | 214 | $resultData = []; |
| 215 | 215 | try { |
| 216 | 216 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
| 217 | - if (! empty($searchArray)) { |
|
| 217 | + if (!empty($searchArray)) { |
|
| 218 | 218 | foreach ($searchArray as $key => $value) { |
| 219 | 219 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
| 220 | 220 | } |
| 221 | - } elseif (! empty($searchString)) { |
|
| 221 | + } elseif (!empty($searchString)) { |
|
| 222 | 222 | // If $column is an array and has more than one item, implode it and wrap in parentheses. |
| 223 | - if (! empty($column) && \count($column) > 1) { |
|
| 223 | + if (!empty($column) && \count($column) > 1) { |
|
| 224 | 224 | $searchColumns = '@('.implode(',', $column).')'; |
| 225 | - } elseif (! empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
| 225 | + } elseif (!empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
| 226 | 226 | $searchColumns = '@'.$column[0]; |
| 227 | 227 | } else { |
| 228 | 228 | $searchColumns = ''; // Careful, this will search all columns. |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->colorCli = new ColorCLI(); |
| 75 | 75 | |
| 76 | 76 | $this->tmpPath = config('nntmux.tmp_unrar_path'); |
| 77 | - if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
| 77 | + if (!preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
| 78 | 78 | $this->tmpPath .= '/'; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $size = \strlen($possibleNFO); |
| 136 | 136 | if ($size < 65535 && |
| 137 | 137 | $size > 11 && |
| 138 | - ! preg_match( |
|
| 138 | + !preg_match( |
|
| 139 | 139 | '/\A(\s*<\?xml|=newz\[NZB\]=|RIFF|\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\s*Generated\s*by.*SF\w/i', |
| 140 | 140 | $possibleNFO |
| 141 | 141 | )) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Linux boxes have 'file' (so should Macs), Windows *can* have it too: see GNUWIN.txt in docs. |
| 147 | 147 | $result = Utility::fileInfo($tmpPath); |
| 148 | - if (! empty($result)) { |
|
| 148 | + if (!empty($result)) { |
|
| 149 | 149 | // Check if it's text. |
| 150 | 150 | if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\s*text/', $result)) { |
| 151 | 151 | @File::delete($tmpPath); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | Release::whereId($release->id)->update(['nfostatus' => self::NFO_FOUND]); |
| 205 | 205 | |
| 206 | - if (! isset($release->completion)) { |
|
| 206 | + if (!isset($release->completion)) { |
|
| 207 | 207 | $release->completion = 0; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->config->language = $this->lookuplanguage; |
| 138 | 138 | $this->config->throwHttpExceptions = false; |
| 139 | 139 | $cacheDir = storage_path('framework/cache/imdb_cache'); |
| 140 | - if (! File::isDirectory($cacheDir)) { |
|
| 140 | + if (!File::isDirectory($cacheDir)) { |
|
| 141 | 141 | File::makeDirectory($cacheDir, 0777, false, true); |
| 142 | 142 | } |
| 143 | 143 | $this->config->cachedir = $cacheDir; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | ORDER BY %s %s %s", |
| 191 | 191 | $this->showPasswords, |
| 192 | 192 | $this->getBrowseBy(), |
| 193 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 193 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 194 | 194 | ( |
| 195 | 195 | $maxAge > 0 |
| 196 | 196 | ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | Cache::put(md5($moviesSql.$page), $movies, $expiresAt); |
| 211 | 211 | } |
| 212 | 212 | $movieIDs = $releaseIDs = []; |
| 213 | - if (! empty($movies['result'])) { |
|
| 213 | + if (!empty($movies['result'])) { |
|
| 214 | 214 | foreach ($movies['result'] as $movie => $id) { |
| 215 | 215 | $movieIDs[] = $id->imdbid; |
| 216 | 216 | $releaseIDs[] = $id->grp_release_id; |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | AND r.id IN (%s) %s |
| 250 | 250 | GROUP BY m.imdbid |
| 251 | 251 | ORDER BY %s %s", |
| 252 | - (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | - (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 252 | + (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | + (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 255 | 255 | $order[0], |
| 256 | 256 | $order[1] |
| 257 | 257 | ); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $browseBy = ' '; |
| 298 | 298 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
| 299 | 299 | foreach ($browseByArr as $bb) { |
| 300 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
| 300 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
| 301 | 301 | $bbv = stripslashes(request()->input($bb)); |
| 302 | 302 | if ($bb === 'rating') { |
| 303 | 303 | $bbv .= '.'; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | if ($this->traktcheck !== null) { |
| 332 | 332 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
| 333 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
| 333 | + if (($data !== false) && !empty($data['trailer'])) { |
|
| 334 | 334 | return $data['trailer']; |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if (! empty($data['trailer'])) { |
|
| 359 | + if (!empty($data['trailer'])) { |
|
| 360 | 360 | $data['trailer'] = str_ireplace( |
| 361 | 361 | ['watch?v=', 'http://'], |
| 362 | 362 | ['embed/', 'https://'], |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | private function checkTraktValue($value) |
| 392 | 392 | { |
| 393 | - if (\is_array($value) && ! empty($value)) { |
|
| 393 | + if (\is_array($value) && !empty($value)) { |
|
| 394 | 394 | $temp = ''; |
| 395 | 395 | foreach ($value as $val) { |
| 396 | - if (! \is_array($val) && ! \is_object($val)) { |
|
| 396 | + if (!\is_array($val) && !\is_object($val)) { |
|
| 397 | 397 | $temp .= $val; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | $value = $temp; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - return ! empty($value) ? $value : ''; |
|
| 403 | + return !empty($value) ? $value : ''; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function update(array $values): bool |
| 423 | 423 | { |
| 424 | - if (! \count($values)) { |
|
| 424 | + if (!\count($values)) { |
|
| 425 | 425 | return false; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $onDuplicateKey = ['created_at' => now()]; |
| 430 | 430 | $found = 0; |
| 431 | 431 | foreach ($values as $key => $value) { |
| 432 | - if (! empty($value)) { |
|
| 432 | + if (!empty($value)) { |
|
| 433 | 433 | $found++; |
| 434 | 434 | if (\in_array($key, ['genre', 'language'], false)) { |
| 435 | 435 | $value = substr($value, 0, 64); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $onDuplicateKey += [$key => $value]; |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | - if (! $found) { |
|
| 441 | + if (!$found) { |
|
| 442 | 442 | return false; |
| 443 | 443 | } |
| 444 | 444 | foreach ($query as $key => $value) { |
@@ -455,19 +455,19 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
| 457 | 457 | { |
| 458 | - if (! empty($variable1)) { |
|
| 458 | + if (!empty($variable1)) { |
|
| 459 | 459 | return $variable1; |
| 460 | 460 | } |
| 461 | - if (! empty($variable2)) { |
|
| 461 | + if (!empty($variable2)) { |
|
| 462 | 462 | return $variable2; |
| 463 | 463 | } |
| 464 | - if (! empty($variable3)) { |
|
| 464 | + if (!empty($variable3)) { |
|
| 465 | 465 | return $variable3; |
| 466 | 466 | } |
| 467 | - if (! empty($variable4)) { |
|
| 467 | + if (!empty($variable4)) { |
|
| 468 | 468 | return $variable4; |
| 469 | 469 | } |
| 470 | - if (! empty($variable5)) { |
|
| 470 | + if (!empty($variable5)) { |
|
| 471 | 471 | return $variable5; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
| 504 | 504 | |
| 505 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
| 505 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
| 506 | 506 | return false; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -515,36 +515,36 @@ discard block |
||
| 515 | 515 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
| 516 | 516 | |
| 517 | 517 | $mov['imdbid'] = $imdbId; |
| 518 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 518 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 520 | 520 | |
| 521 | 521 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
| 522 | - if (! empty($fanart['cover'])) { |
|
| 522 | + if (!empty($fanart['cover'])) { |
|
| 523 | 523 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
| 524 | - } elseif (! empty($tmdb['cover'])) { |
|
| 524 | + } elseif (!empty($tmdb['cover'])) { |
|
| 525 | 525 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
| 526 | - } elseif (! empty($imdb['cover'])) { |
|
| 526 | + } elseif (!empty($imdb['cover'])) { |
|
| 527 | 527 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
| 528 | - } elseif (! empty($omdb['cover'])) { |
|
| 528 | + } elseif (!empty($omdb['cover'])) { |
|
| 529 | 529 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
| 530 | - } elseif (! empty($iTunes['cover'])) { |
|
| 530 | + } elseif (!empty($iTunes['cover'])) { |
|
| 531 | 531 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // Backdrops. |
| 535 | - if (! empty($fanart['backdrop'])) { |
|
| 535 | + if (!empty($fanart['backdrop'])) { |
|
| 536 | 536 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
| 537 | - } elseif (! empty($tmdb['backdrop'])) { |
|
| 537 | + } elseif (!empty($tmdb['backdrop'])) { |
|
| 538 | 538 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | // Banner |
| 542 | - if (! empty($fanart['banner'])) { |
|
| 542 | + if (!empty($fanart['banner'])) { |
|
| 543 | 543 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | // RottenTomatoes rating from OmdbAPI |
| 547 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
| 547 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
| 548 | 548 | $mov['rtrating'] = $omdb['rtRating']; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -555,29 +555,29 @@ discard block |
||
| 555 | 555 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
| 556 | 556 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
| 557 | 557 | |
| 558 | - if (! empty($imdb['type'])) { |
|
| 558 | + if (!empty($imdb['type'])) { |
|
| 559 | 559 | $mov['type'] = $imdb['type']; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if (! empty($imdb['director'])) { |
|
| 562 | + if (!empty($imdb['director'])) { |
|
| 563 | 563 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
| 564 | - } elseif (! empty($omdb['director'])) { |
|
| 564 | + } elseif (!empty($omdb['director'])) { |
|
| 565 | 565 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
| 566 | - } elseif (! empty($tmdb['director'])) { |
|
| 566 | + } elseif (!empty($tmdb['director'])) { |
|
| 567 | 567 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - if (! empty($imdb['actors'])) { |
|
| 570 | + if (!empty($imdb['actors'])) { |
|
| 571 | 571 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
| 572 | - } elseif (! empty($omdb['actors'])) { |
|
| 572 | + } elseif (!empty($omdb['actors'])) { |
|
| 573 | 573 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
| 574 | - } elseif (! empty($tmdb['actors'])) { |
|
| 574 | + } elseif (!empty($tmdb['actors'])) { |
|
| 575 | 575 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if (! empty($imdb['language'])) { |
|
| 578 | + if (!empty($imdb['language'])) { |
|
| 579 | 579 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
| 580 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
| 580 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
| 581 | 581 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -635,20 +635,20 @@ discard block |
||
| 635 | 635 | if ($this->fanartapikey !== null) { |
| 636 | 636 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
| 637 | 637 | |
| 638 | - if (! empty($art)) { |
|
| 638 | + if (!empty($art)) { |
|
| 639 | 639 | if (isset($art['status']) && $art['status'] === 'error') { |
| 640 | 640 | return false; |
| 641 | 641 | } |
| 642 | 642 | $ret = []; |
| 643 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
| 643 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
| 644 | 644 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
| 645 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
| 645 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
| 646 | 646 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
| 647 | 647 | } |
| 648 | - if (! empty($art['movieposter'][0]['url'])) { |
|
| 648 | + if (!empty($art['movieposter'][0]['url'])) { |
|
| 649 | 649 | $ret['cover'] = $art['movieposter'][0]['url']; |
| 650 | 650 | } |
| 651 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
| 651 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
| 652 | 652 | $ret['banner'] = $art['moviebanner'][0]['url']; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | return false; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if (! empty($tmdbLookup)) { |
|
| 688 | + if (!empty($tmdbLookup)) { |
|
| 689 | 689 | if ($this->currentTitle !== '') { |
| 690 | 690 | // Check the similarity. |
| 691 | 691 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | $ret['rating'] = ''; |
| 715 | 715 | } |
| 716 | 716 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
| 717 | - if (! empty($actors)) { |
|
| 717 | + if (!empty($actors)) { |
|
| 718 | 718 | $ret['actors'] = $actors; |
| 719 | 719 | } else { |
| 720 | 720 | $ret['actors'] = ''; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | $overview = $tmdbLookup['overview']; |
| 728 | - if (! empty($overview)) { |
|
| 728 | + if (!empty($overview)) { |
|
| 729 | 729 | $ret['plot'] = $overview; |
| 730 | 730 | } else { |
| 731 | 731 | $ret['plot'] = ''; |
@@ -735,13 +735,13 @@ discard block |
||
| 735 | 735 | $ret['tagline'] = $tagline ?? ''; |
| 736 | 736 | |
| 737 | 737 | $released = $tmdbLookup['release_date']; |
| 738 | - if (! empty($released)) { |
|
| 738 | + if (!empty($released)) { |
|
| 739 | 739 | $ret['year'] = Carbon::parse($released)->year; |
| 740 | 740 | } else { |
| 741 | 741 | $ret['year'] = ''; |
| 742 | 742 | } |
| 743 | 743 | $genresa = $tmdbLookup['genres']; |
| 744 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
| 744 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
| 745 | 745 | $genres = []; |
| 746 | 746 | foreach ($genresa as $genre) { |
| 747 | 747 | $genres[] = $genre['name']; |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | $ret['genre'] = ''; |
| 752 | 752 | } |
| 753 | 753 | $posterp = $tmdbLookup['poster_path']; |
| 754 | - if (! empty($posterp)) { |
|
| 754 | + if (!empty($posterp)) { |
|
| 755 | 755 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
| 756 | 756 | } else { |
| 757 | 757 | $ret['cover'] = ''; |
| 758 | 758 | } |
| 759 | 759 | $backdrop = $tmdbLookup['backdrop_path']; |
| 760 | - if (! empty($backdrop)) { |
|
| 760 | + if (!empty($backdrop)) { |
|
| 761 | 761 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
| 762 | 762 | } else { |
| 763 | 763 | $ret['backdrop'] = ''; |
@@ -779,9 +779,9 @@ discard block |
||
| 779 | 779 | { |
| 780 | 780 | $realId = (new Title($imdbId, $this->config))->real_id(); |
| 781 | 781 | $result = new Title($realId, $this->config); |
| 782 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | - if (! empty($title)) { |
|
| 784 | - if (! empty($this->currentTitle)) { |
|
| 782 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | + if (!empty($title)) { |
|
| 784 | + if (!empty($this->currentTitle)) { |
|
| 785 | 785 | similar_text($this->currentTitle, $title, $percent); |
| 786 | 786 | if ($percent >= self::MATCH_PERCENT) { |
| 787 | 787 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | 'title' => $title, |
| 791 | 791 | 'tagline' => $result->tagline() ?? '', |
| 792 | 792 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 793 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 793 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 794 | 794 | 'year' => $result->year() ?? '', |
| 795 | 795 | 'cover' => $result->photo() ?? '', |
| 796 | 796 | 'genre' => $result->genre() ?? '', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'title' => $title, |
| 816 | 816 | 'tagline' => $result->tagline() ?? '', |
| 817 | 817 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 818 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 818 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 819 | 819 | 'year' => $result->year() ?? '', |
| 820 | 820 | 'cover' => $result->photo() ?? '', |
| 821 | 821 | 'genre' => $result->genre() ?? '', |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | if ($this->omdbapikey !== null) { |
| 890 | 890 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
| 891 | 891 | |
| 892 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 892 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 893 | 893 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
| 894 | 894 | if ($percent >= self::MATCH_PERCENT) { |
| 895 | 895 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | // Loop over releases. |
| 1056 | 1056 | foreach ($res as $arr) { |
| 1057 | 1057 | // Try to get a name/year. |
| 1058 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
| 1058 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
| 1059 | 1059 | //We didn't find a name, so set to all 0's so we don't parse again. |
| 1060 | 1060 | Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); |
| 1061 | 1061 | |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $imdbSearch = new TitleSearch($this->config); |
| 1090 | 1090 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
| 1091 | 1091 | try { |
| 1092 | - if (! empty($imdbTitle->title())) { |
|
| 1092 | + if (!empty($imdbTitle->title())) { |
|
| 1093 | 1093 | similar_text($imdbTitle->title(), $this->currentTitle, $percent); |
| 1094 | 1094 | if ($percent >= self::MATCH_PERCENT) { |
| 1095 | 1095 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1119,10 +1119,10 @@ discard block |
||
| 1119 | 1119 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1122 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1123 | 1123 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
| 1124 | 1124 | |
| 1125 | - if (! empty($getIMDBid)) { |
|
| 1125 | + if (!empty($getIMDBid)) { |
|
| 1126 | 1126 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
| 1127 | 1127 | if ($imdbId !== false) { |
| 1128 | 1128 | $movieUpdated = true; |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
| 1138 | 1138 | if ($data !== false) { |
| 1139 | 1139 | $this->parseTraktTv($data); |
| 1140 | - if (! empty($data['ids']['imdb'])) { |
|
| 1140 | + if (!empty($data['ids']['imdb'])) { |
|
| 1141 | 1141 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
| 1142 | 1142 | if ($imdbId !== false) { |
| 1143 | 1143 | $movieUpdated = true; |
@@ -1150,13 +1150,13 @@ discard block |
||
| 1150 | 1150 | if ($movieUpdated === false) { |
| 1151 | 1151 | try { |
| 1152 | 1152 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
| 1153 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
| 1153 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
| 1154 | 1154 | foreach ($data['results'] as $result) { |
| 1155 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
| 1155 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
| 1156 | 1156 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
| 1157 | 1157 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
| 1158 | 1158 | $ret = $this->fetchTMDBProperties($result['id'], true); |
| 1159 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
| 1159 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
| 1160 | 1160 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
| 1161 | 1161 | if ($imdbId !== false) { |
| 1162 | 1162 | $movieUpdated = true; |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | // Finally remove multiple spaces and trim leading spaces. |
| 1258 | 1258 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
| 1259 | 1259 | // Check if the name is long enough and not just numbers. |
| 1260 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
| 1260 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
| 1261 | 1261 | $this->currentTitle = $name; |
| 1262 | 1262 | $this->currentYear = $year; |
| 1263 | 1263 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function beginImport($filesToProcess, bool $useNzbName = false, bool $delete = false, bool $deleteFailed = false): bool|string |
| 81 | 81 | { |
| 82 | 82 | // Get all the groups in the DB. |
| 83 | - if (! $this->getAllGroups()) { |
|
| 83 | + if (!$this->getAllGroups()) { |
|
| 84 | 84 | if ($this->browser) { |
| 85 | 85 | return $this->retVal; |
| 86 | 86 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | gzwrite($fp, $nzbString); |
| 146 | 146 | gzclose($fp); |
| 147 | 147 | |
| 148 | - if (! File::isFile($path)) { |
|
| 148 | + if (!File::isFile($path)) { |
|
| 149 | 149 | $this->echoOut('ERROR: Problem compressing NZB file to: '.$path); |
| 150 | 150 | |
| 151 | 151 | // Remove the release. |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ($groupID === -1) { |
| 232 | 232 | if (array_key_exists($group, $this->allGroups)) { |
| 233 | 233 | $groupID = $this->allGroups[$group]; |
| 234 | - if (! $groupName) { |
|
| 234 | + if (!$groupName) { |
|
| 235 | 235 | $groupName = $group; |
| 236 | 236 | } |
| 237 | 237 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // If we found a group and it's not blacklisted. |
| 268 | - if ($groupID !== -1 && ! $isBlackListed) { |
|
| 268 | + if ($groupID !== -1 && !$isBlackListed) { |
|
| 269 | 269 | // Get the size of the release. |
| 270 | 270 | if (\count($file->segments->segment) > 0) { |
| 271 | 271 | foreach ($file->segments->segment as $segment) { |
@@ -291,11 +291,11 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | // Pass the binary extractors to ArchiveInfo. |
| 293 | 293 | $clients = []; |
| 294 | - if (! empty(Settings::settingValue('apps..unrarpath'))) { |
|
| 294 | + if (!empty(Settings::settingValue('apps..unrarpath'))) { |
|
| 295 | 295 | $this->_unrarPath = Settings::settingValue('apps..unrarpath'); |
| 296 | 296 | $clients += [ArchiveInfo::TYPE_RAR => $this->_unrarPath]; |
| 297 | 297 | } |
| 298 | - if (! empty(Settings::settingValue('apps..zippath'))) { |
|
| 298 | + if (!empty(Settings::settingValue('apps..zippath'))) { |
|
| 299 | 299 | $this->_7zipPath = Settings::settingValue('apps..zippath'); |
| 300 | 300 | $clients += [ArchiveInfo::TYPE_SZIP => $this->_7zipPath]; |
| 301 | 301 | $clients += [ArchiveInfo::TYPE_ZIP => $this->_7zipPath]; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $this->_archiveInfo->setExternalClients($clients); |
| 304 | 304 | |
| 305 | 305 | $this->_killString = '"'; |
| 306 | - if (! empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
| 306 | + if (!empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
| 307 | 307 | $this->_killString = ( |
| 308 | 308 | '"'.Settings::settingValue('apps..timeoutpath'). |
| 309 | 309 | '" --foreground --signal=KILL '. |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0; |
| 345 | 345 | |
| 346 | - if (! Settings::settingValue('apps..ffmpegpath')) { |
|
| 346 | + if (!Settings::settingValue('apps..ffmpegpath')) { |
|
| 347 | 347 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
| 348 | 348 | } else { |
| 349 | 349 | $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; |
| 355 | 355 | $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== ''; |
| 356 | 356 | $this->_processAudioInfo = $this->_processMediaInfo; |
| 357 | - $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); |
|
| 357 | + $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath')); |
|
| 358 | 358 | |
| 359 | 359 | $this->_audioSavePath = storage_path('covers/audiosample/'); |
| 360 | 360 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $this->_mainTmpPath = config('nntmux.tmp_unrar_path'); |
| 412 | 412 | |
| 413 | 413 | // Check if it ends with a dir separator. |
| 414 | - if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
| 414 | + if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
| 415 | 415 | $this->_mainTmpPath .= '/'; |
| 416 | 416 | } |
| 417 | 417 | |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | $this->_mainTmpPath .= ($guidChar.'/'); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 426 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
| 425 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 426 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
| 427 | 427 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 431 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 432 | 432 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
| 433 | 433 | } |
| 434 | 434 | |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | if ($this->_minSize > 0) { |
| 467 | 467 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
| 468 | 468 | } |
| 469 | - if (! empty($groupID)) { |
|
| 469 | + if (!empty($groupID)) { |
|
| 470 | 470 | $releasesQuery->where('releases.groups_id', $groupID); |
| 471 | 471 | } |
| 472 | - if (! empty($guidChar)) { |
|
| 472 | + if (!empty($guidChar)) { |
|
| 473 | 473 | $releasesQuery->where('releases.leftguid', $guidChar); |
| 474 | 474 | } |
| 475 | 475 | $releasesQuery->select(['releases.id', 'releases.id as releases_id', 'releases.guid', 'releases.name', 'releases.size', 'releases.groups_id', 'releases.nfostatus', 'releases.fromname', 'releases.completion', 'releases.categories_id', 'releases.searchname', 'releases.predb_id', 'categories.disablepreview']) |
@@ -523,12 +523,12 @@ discard block |
||
| 523 | 523 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
| 524 | 524 | |
| 525 | 525 | // Create folder to store temporary files. |
| 526 | - if (! $this->_createTempFolder()) { |
|
| 526 | + if (!$this->_createTempFolder()) { |
|
| 527 | 527 | continue; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | // Get NZB contents. |
| 531 | - if (! $this->_getNZBContents()) { |
|
| 531 | + if (!$this->_getNZBContents()) { |
|
| 532 | 532 | continue; |
| 533 | 533 | } |
| 534 | 534 | |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | $this->_processMessageIDDownloads(); |
| 551 | 551 | |
| 552 | 552 | // Process compressed (RAR/ZIP) files inside the NZB. |
| 553 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
| 553 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
| 554 | 554 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
| 555 | 555 | $this->_processNZBCompressedFiles(); |
| 556 | 556 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | $this->_processNZBCompressedFiles(true); |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if (! $this->_releaseHasPassword) { |
|
| 562 | + if (!$this->_releaseHasPassword) { |
|
| 563 | 563 | // Process the extracted files to get video/audio samples/etc. |
| 564 | 564 | $this->_processExtractedFiles(); |
| 565 | 565 | } |
@@ -603,10 +603,10 @@ discard block |
||
| 603 | 603 | { |
| 604 | 604 | // Per release defaults. |
| 605 | 605 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
| 606 | - if (! File::isDirectory($this->tmpPath)) { |
|
| 607 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
| 606 | + if (!File::isDirectory($this->tmpPath)) { |
|
| 607 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
| 608 | 608 | // We will try to create the main temp folder again, just in case there was a file lock or filesystem issue. |
| 609 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
| 609 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
| 610 | 610 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
| 611 | 611 | |
| 612 | 612 | return false; |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
| 629 | 629 | if ($nzbPath !== false) { |
| 630 | 630 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
| 631 | - if (! $nzbContents) { |
|
| 631 | + if (!$nzbContents) { |
|
| 632 | 632 | if ($this->_echoCLI) { |
| 633 | 633 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
| 634 | 634 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Check if it's a rar/zip. |
| 692 | - if (! $this->_NZBHasCompressedFile && |
|
| 692 | + if (!$this->_NZBHasCompressedFile && |
|
| 693 | 693 | preg_match( |
| 694 | 694 | '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', |
| 695 | 695 | $this->_currentNZBFile['title'] |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | // Look for a video sample, make sure it's not an image. |
| 702 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 702 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 703 | 703 | ) { |
| 704 | 704 | // Get the amount of segments for this file. |
| 705 | 705 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | // Look for a JPG picture, make sure it's not a CD cover. |
| 716 | - if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) |
|
| 716 | + if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) |
|
| 717 | 717 | ) { |
| 718 | 718 | // Get the amount of segments for this file. |
| 719 | 719 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | $this->_reverse = $reverse; |
| 766 | 766 | |
| 767 | 767 | if ($this->_reverse) { |
| 768 | - if (! krsort($this->_nzbContents)) { |
|
| 768 | + if (!krsort($this->_nzbContents)) { |
|
| 769 | 769 | return; |
| 770 | 770 | } |
| 771 | 771 | } else { |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | // Probably not a rar/zip. |
| 792 | - if (! preg_match( |
|
| 792 | + if (!preg_match( |
|
| 793 | 793 | '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', |
| 794 | 794 | $nzbFile['title'] |
| 795 | 795 | ) |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | break; |
| 806 | 806 | } |
| 807 | 807 | $segment = (string) $nzbFile['segments'][$i]; |
| 808 | - if (! $this->_reverse) { |
|
| 808 | + if (!$this->_reverse) { |
|
| 809 | 809 | $this->_triedCompressedMids[] = $segment; |
| 810 | 810 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
| 811 | 811 | // We already downloaded this file. |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | { |
| 858 | 858 | $this->_compressedFilesChecked++; |
| 859 | 859 | // Give the data to archive info, so it can check if it's a rar. |
| 860 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
| 860 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
| 861 | 861 | if (config('app.debug') === true) { |
| 862 | 862 | $this->_debug('Data is probably not RAR or ZIP.'); |
| 863 | 863 | } |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | // Check if the compressed file is encrypted. |
| 890 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 890 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 891 | 891 | if (config('app.debug') === true) { |
| 892 | 892 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
| 893 | 893 | } |
@@ -899,13 +899,13 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | if ($this->_reverse) { |
| 901 | 901 | $fileData = $dataSummary['file_list'] ?? []; |
| 902 | - if (! empty($fileData)) { |
|
| 902 | + if (!empty($fileData)) { |
|
| 903 | 903 | $rarFileName = Arr::pluck($fileData, 'name'); |
| 904 | 904 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
| 905 | 905 | $preCheck = Predb::whereTitle($hit[0])->first(); |
| 906 | 906 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
| 907 | 907 | (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
| 908 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 908 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 909 | 909 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
| 910 | 910 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
| 911 | 911 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | $this->_echo('r', 'primaryOver'); |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 926 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 927 | 927 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
| 928 | 928 | File::put($fileName, $compressedData); |
| 929 | 929 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $this->_echo('7z', 'primaryOver'); |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
| 938 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
| 939 | 939 | $fileName = $this->tmpPath.uniqid('', true).'.7z'; |
| 940 | 940 | File::put($fileName, $compressedData); |
| 941 | 941 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | $this->_echo('z', 'primaryOver'); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
| 951 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
| 952 | 952 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
| 953 | 953 | File::put($fileName, $compressedData); |
| 954 | 954 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | { |
| 974 | 974 | // Get a list of files inside the Compressed file. |
| 975 | 975 | $files = $this->_archiveInfo->getArchiveFileList(); |
| 976 | - if (! \is_array($files) || \count($files) === 0) { |
|
| 976 | + if (!\is_array($files) || \count($files) === 0) { |
|
| 977 | 977 | return false; |
| 978 | 978 | } |
| 979 | 979 | |
@@ -1043,8 +1043,8 @@ discard block |
||
| 1043 | 1043 | protected function _addFileInfo(&$file): void |
| 1044 | 1044 | { |
| 1045 | 1045 | // Don't add rar/zip files to the DB. |
| 1046 | - if (! isset($file['error']) && isset($file['source']) && |
|
| 1047 | - ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) |
|
| 1046 | + if (!isset($file['error']) && isset($file['source']) && |
|
| 1047 | + !preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) |
|
| 1048 | 1048 | ) { |
| 1049 | 1049 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
| 1050 | 1050 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
| 1057 | 1057 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
| 1058 | - if (! empty($addReleaseFiles)) { |
|
| 1058 | + if (!empty($addReleaseFiles)) { |
|
| 1059 | 1059 | $this->_addedFileInfo++; |
| 1060 | 1060 | |
| 1061 | 1061 | if ($this->_echoCLI) { |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | $this->_releaseHasPassword = true; |
| 1071 | 1071 | $this->_passwordStatus = Releases::PASSWD_RAR; |
| 1072 | 1072 | } //Run a PreDB filename check on insert to try and match the release |
| 1073 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
| 1073 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
| 1074 | 1074 | $this->_release['filename'] = $file['name']; |
| 1075 | 1075 | $this->_release['releases_id'] = $this->_release->id; |
| 1076 | 1076 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | // If we found no compressed files, break out. |
| 1119 | - if (! $foundCompressedFile) { |
|
| 1119 | + if (!$foundCompressedFile) { |
|
| 1120 | 1120 | break; |
| 1121 | 1121 | } |
| 1122 | 1122 | |
@@ -1138,39 +1138,39 @@ discard block |
||
| 1138 | 1138 | |
| 1139 | 1139 | if (File::isFile($file)) { |
| 1140 | 1140 | // Process PAR2 files. |
| 1141 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1141 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1142 | 1142 | $this->_siftPAR2Info($file); |
| 1143 | 1143 | } // Process NFO files. |
| 1144 | 1144 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
| 1145 | 1145 | $this->_processNfoFile($file); |
| 1146 | 1146 | } // Process audio files. |
| 1147 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1147 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1148 | 1148 | // Try to get audio sample/audio media info. |
| 1149 | 1149 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
| 1150 | 1150 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
| 1151 | 1151 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
| 1152 | 1152 | } // Process JPG files. |
| 1153 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1153 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1154 | 1154 | $this->_getJPGSample($file); |
| 1155 | 1155 | File::delete($file); |
| 1156 | 1156 | } // Video sample // video clip // video media info. |
| 1157 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1157 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1158 | 1158 | $this->_processVideoFile($file); |
| 1159 | 1159 | } // Check file's magic info. |
| 1160 | 1160 | else { |
| 1161 | 1161 | $output = Utility::fileInfo($file); |
| 1162 | - if (! empty($output)) { |
|
| 1162 | + if (!empty($output)) { |
|
| 1163 | 1163 | switch (true) { |
| 1164 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1164 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1165 | 1165 | $this->_getJPGSample($file); |
| 1166 | 1166 | File::delete($file); |
| 1167 | 1167 | break; |
| 1168 | 1168 | |
| 1169 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1169 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1170 | 1170 | $this->_processVideoFile($file); |
| 1171 | 1171 | break; |
| 1172 | 1172 | |
| 1173 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1173 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1174 | 1174 | switch ($fileType[0]) { |
| 1175 | 1175 | case 'FLAC': |
| 1176 | 1176 | $fileType = 'FLAC'; |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
| 1188 | 1188 | break; |
| 1189 | 1189 | |
| 1190 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1190 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1191 | 1191 | $this->_siftPAR2Info($file); |
| 1192 | 1192 | break; |
| 1193 | 1193 | } |
@@ -1223,8 +1223,8 @@ discard block |
||
| 1223 | 1223 | protected function _processSampleMessageIDs(): void |
| 1224 | 1224 | { |
| 1225 | 1225 | // Download and process sample image. |
| 1226 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1227 | - if (! empty($this->_sampleMessageIDs)) { |
|
| 1226 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
| 1227 | + if (!empty($this->_sampleMessageIDs)) { |
|
| 1228 | 1228 | // Download it from usenet. |
| 1229 | 1229 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
| 1230 | 1230 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1243,12 +1243,12 @@ discard block |
||
| 1243 | 1243 | File::put($fileLocation, $sampleBinary); |
| 1244 | 1244 | |
| 1245 | 1245 | // Try to get a sample picture. |
| 1246 | - if (! $this->_foundSample) { |
|
| 1246 | + if (!$this->_foundSample) { |
|
| 1247 | 1247 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | // Try to get a sample video. |
| 1251 | - if (! $this->_foundVideo) { |
|
| 1251 | + if (!$this->_foundVideo) { |
|
| 1252 | 1252 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
@@ -1269,8 +1269,8 @@ discard block |
||
| 1269 | 1269 | protected function _processMediaInfoMessageIDs(): void |
| 1270 | 1270 | { |
| 1271 | 1271 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
| 1272 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1273 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
| 1272 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
| 1273 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
| 1274 | 1274 | // Try to download it from usenet. |
| 1275 | 1275 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
| 1276 | 1276 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1290,17 +1290,17 @@ discard block |
||
| 1290 | 1290 | File::put($fileLocation, $mediaBinary); |
| 1291 | 1291 | |
| 1292 | 1292 | // Try to get media info. |
| 1293 | - if (! $this->_foundMediaInfo) { |
|
| 1293 | + if (!$this->_foundMediaInfo) { |
|
| 1294 | 1294 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | // Try to get a sample picture. |
| 1298 | - if (! $this->_foundSample) { |
|
| 1298 | + if (!$this->_foundSample) { |
|
| 1299 | 1299 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | // Try to get a sample video. |
| 1303 | - if (! $this->_foundVideo) { |
|
| 1303 | + if (!$this->_foundVideo) { |
|
| 1304 | 1304 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1305 | 1305 | } |
| 1306 | 1306 | } |
@@ -1321,8 +1321,8 @@ discard block |
||
| 1321 | 1321 | protected function _processAudioInfoMessageIDs(): void |
| 1322 | 1322 | { |
| 1323 | 1323 | // Download audio file, use media info to try to get the artist / album. |
| 1324 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
| 1325 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
| 1324 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
| 1325 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
| 1326 | 1326 | // Try to download it from usenet. |
| 1327 | 1327 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
| 1328 | 1328 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | protected function _processJPGMessageIDs(): void |
| 1358 | 1358 | { |
| 1359 | 1359 | // Download JPG file. |
| 1360 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
| 1360 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
| 1361 | 1361 | // Try to download it. |
| 1362 | 1362 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
| 1363 | 1363 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1426,12 +1426,12 @@ discard block |
||
| 1426 | 1426 | $this->_passwordStatus = max([$this->_passwordStatus]); |
| 1427 | 1427 | |
| 1428 | 1428 | // Set the release to no password if password processing is off. |
| 1429 | - if (! $this->_processPasswords) { |
|
| 1429 | + if (!$this->_processPasswords) { |
|
| 1430 | 1430 | $this->_releaseHasPassword = false; |
| 1431 | 1431 | } |
| 1432 | 1432 | |
| 1433 | 1433 | // If we failed to get anything from the RAR/ZIPs update the release with what we have, if the rar/zip has no password. |
| 1434 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1434 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1435 | 1435 | $release = Release::query()->where('id', $this->_release->id); |
| 1436 | 1436 | $release->update( |
| 1437 | 1437 | $updateRows |
@@ -1488,19 +1488,19 @@ discard block |
||
| 1488 | 1488 | $retVal = $audVal = false; |
| 1489 | 1489 | |
| 1490 | 1490 | // Check if audio sample fetching is on. |
| 1491 | - if (! $this->_processAudioSample) { |
|
| 1491 | + if (!$this->_processAudioSample) { |
|
| 1492 | 1492 | $audVal = true; |
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | // Check if media info fetching is on. |
| 1496 | - if (! $this->_processAudioInfo) { |
|
| 1496 | + if (!$this->_processAudioInfo) { |
|
| 1497 | 1497 | $retVal = true; |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
| 1501 | 1501 | |
| 1502 | 1502 | $musicParent = (string) Category::MUSIC_ROOT; |
| 1503 | - if ($rQuery === null || ! preg_match( |
|
| 1503 | + if ($rQuery === null || !preg_match( |
|
| 1504 | 1504 | sprintf( |
| 1505 | 1505 | '/%d\d{3}|%d|%d|%d/', |
| 1506 | 1506 | $musicParent[0], |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | |
| 1517 | 1517 | if (File::isFile($fileLocation)) { |
| 1518 | 1518 | // Check if media info is enabled. |
| 1519 | - if (! $retVal) { |
|
| 1519 | + if (!$retVal) { |
|
| 1520 | 1520 | // Get the media info for the file. |
| 1521 | 1521 | try { |
| 1522 | 1522 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | $ext = strtoupper($fileExtension); |
| 1530 | 1530 | |
| 1531 | 1531 | // Form a new search name. |
| 1532 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1532 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1533 | 1533 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
| 1534 | 1534 | } else { |
| 1535 | 1535 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1591,7 +1591,7 @@ discard block |
||
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | 1593 | // Check if creating audio samples is enabled. |
| 1594 | - if (! $audVal) { |
|
| 1594 | + if (!$audVal) { |
|
| 1595 | 1595 | // File name to store audio file. |
| 1596 | 1596 | $audioFileName = ($this->_release->guid.'.ogg'); |
| 1597 | 1597 | |
@@ -1615,7 +1615,7 @@ discard block |
||
| 1615 | 1615 | // Try to move the temp audio file. |
| 1616 | 1616 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1617 | 1617 | |
| 1618 | - if (! $renamed) { |
|
| 1618 | + if (!$renamed) { |
|
| 1619 | 1619 | // Try to copy it if it fails. |
| 1620 | 1620 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1621 | 1621 | |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | File::delete($this->tmpPath.$audioFileName); |
| 1624 | 1624 | |
| 1625 | 1625 | // If it didn't copy continue. |
| 1626 | - if (! $copied) { |
|
| 1626 | + if (!$copied) { |
|
| 1627 | 1627 | return false; |
| 1628 | 1628 | } |
| 1629 | 1629 | } |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1678 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1679 | 1679 | return ''; |
| 1680 | 1680 | } |
| 1681 | 1681 | |
@@ -1696,7 +1696,7 @@ discard block |
||
| 1696 | 1696 | */ |
| 1697 | 1697 | protected function _getSample(string $fileLocation): bool |
| 1698 | 1698 | { |
| 1699 | - if (! $this->_processThumbnails) { |
|
| 1699 | + if (!$this->_processThumbnails) { |
|
| 1700 | 1700 | return false; |
| 1701 | 1701 | } |
| 1702 | 1702 | |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | */ |
| 1762 | 1762 | protected function _getVideo(string $fileLocation): bool |
| 1763 | 1763 | { |
| 1764 | - if (! $this->_processVideo) { |
|
| 1764 | + if (!$this->_processVideo) { |
|
| 1765 | 1765 | return false; |
| 1766 | 1766 | } |
| 1767 | 1767 | |
@@ -1816,7 +1816,7 @@ discard block |
||
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | // If longer than 60 or we could not get the video length, run the old way. |
| 1819 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1819 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1820 | 1820 | try { |
| 1821 | 1821 | $video = $this->ffmpeg->open($fileLocation); |
| 1822 | 1822 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1839,14 +1839,14 @@ discard block |
||
| 1839 | 1839 | |
| 1840 | 1840 | // Try to move the file to the new path. |
| 1841 | 1841 | // If we couldn't rename it, try to copy it. |
| 1842 | - if (! @File::move($fileName, $newFile)) { |
|
| 1842 | + if (!@File::move($fileName, $newFile)) { |
|
| 1843 | 1843 | $copied = @File::copy($fileName, $newFile); |
| 1844 | 1844 | |
| 1845 | 1845 | // Delete the old file. |
| 1846 | 1846 | File::delete($fileName); |
| 1847 | 1847 | |
| 1848 | 1848 | // If it didn't copy, continue. |
| 1849 | - if (! $copied) { |
|
| 1849 | + if (!$copied) { |
|
| 1850 | 1850 | return false; |
| 1851 | 1851 | } |
| 1852 | 1852 | } |
@@ -1872,7 +1872,7 @@ discard block |
||
| 1872 | 1872 | */ |
| 1873 | 1873 | protected function _getMediaInfo($fileLocation): bool |
| 1874 | 1874 | { |
| 1875 | - if (! $this->_processMediaInfo) { |
|
| 1875 | + if (!$this->_processMediaInfo) { |
|
| 1876 | 1876 | return false; |
| 1877 | 1877 | } |
| 1878 | 1878 | |
@@ -1947,7 +1947,7 @@ discard block |
||
| 1947 | 1947 | $filesAdded = 0; |
| 1948 | 1948 | |
| 1949 | 1949 | foreach ($this->_par2Info->getFileList() as $file) { |
| 1950 | - if (! isset($file['name'])) { |
|
| 1950 | + if (!isset($file['name'])) { |
|
| 1951 | 1951 | continue; |
| 1952 | 1952 | } |
| 1953 | 1953 | |
@@ -1970,7 +1970,7 @@ discard block |
||
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | 1972 | // Try to get a new name. |
| 1973 | - if (! $foundName) { |
|
| 1973 | + if (!$foundName) { |
|
| 1974 | 1974 | $this->_release->textstring = $file['name']; |
| 1975 | 1975 | $this->_release->releases_id = $this->_release->id; |
| 1976 | 1976 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -2000,7 +2000,7 @@ discard block |
||
| 2000 | 2000 | protected function _processVideoFile($fileLocation): void |
| 2001 | 2001 | { |
| 2002 | 2002 | // Try to get a sample with it. |
| 2003 | - if (! $this->_foundSample) { |
|
| 2003 | + if (!$this->_foundSample) { |
|
| 2004 | 2004 | $this->_foundSample = $this->_getSample($fileLocation); |
| 2005 | 2005 | } |
| 2006 | 2006 | |
@@ -2008,12 +2008,12 @@ discard block |
||
| 2008 | 2008 | * Don't get it here if _sampleMessageIDs is empty |
| 2009 | 2009 | * or has 1 message-id (Saves downloading another part). |
| 2010 | 2010 | */ |
| 2011 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 2011 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 2012 | 2012 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 2013 | 2013 | } |
| 2014 | 2014 | |
| 2015 | 2015 | // Try to get media info with it. |
| 2016 | - if (! $this->_foundMediaInfo) { |
|
| 2016 | + if (!$this->_foundMediaInfo) { |
|
| 2017 | 2017 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 2018 | 2018 | } |
| 2019 | 2019 | } |
@@ -2035,24 +2035,24 @@ discard block |
||
| 2035 | 2035 | $bf = true; |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2038 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2039 | 2039 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
| 2040 | 2040 | $af = true; |
| 2041 | 2041 | } |
| 2042 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2042 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2043 | 2043 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
| 2044 | 2044 | $bf = true; |
| 2045 | 2045 | } |
| 2046 | 2046 | |
| 2047 | - if (! $af && ! $bf) { |
|
| 2047 | + if (!$af && !$bf) { |
|
| 2048 | 2048 | return strnatcasecmp($a, $b); |
| 2049 | 2049 | } |
| 2050 | 2050 | |
| 2051 | - if (! $bf) { |
|
| 2051 | + if (!$bf) { |
|
| 2052 | 2052 | return -1; |
| 2053 | 2053 | } |
| 2054 | 2054 | |
| 2055 | - if (! $af) { |
|
| 2055 | + if (!$af) { |
|
| 2056 | 2056 | return 1; |
| 2057 | 2057 | } |
| 2058 | 2058 | |
@@ -2077,12 +2077,12 @@ discard block |
||
| 2077 | 2077 | protected function _resetReleaseStatus(): void |
| 2078 | 2078 | { |
| 2079 | 2079 | // Only process for samples, previews and images if not disabled. |
| 2080 | - $this->_foundVideo = ! $this->_processVideo; |
|
| 2081 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
| 2082 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
| 2083 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
| 2084 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
| 2085 | - $this->_foundSample = ! $this->_processThumbnails; |
|
| 2080 | + $this->_foundVideo = !$this->_processVideo; |
|
| 2081 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
| 2082 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
| 2083 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
| 2084 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
| 2085 | + $this->_foundSample = !$this->_processThumbnails; |
|
| 2086 | 2086 | $this->_foundPAR2Info = false; |
| 2087 | 2087 | |
| 2088 | 2088 | $this->_passwordStatus = Releases::PASSWD_NONE; |