@@ -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 | try { |
1090 | 1090 | $imdbSearch = new TitleSearch($this->config); |
1091 | 1091 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
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 |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | $browseBy = ' '; |
300 | 300 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
301 | - if (! empty($_REQUEST[$bbk])) { |
|
301 | + if (!empty($_REQUEST[$bbk])) { |
|
302 | 302 | $bbs = stripslashes($_REQUEST[$bbk]); |
303 | 303 | if ($bbk === 'year') { |
304 | 304 | $browseBy .= ' AND YEAR (gi.releasedate) '.'LIKE '.escapeString('%'.$bbs.'%'); |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | if (empty($this->_gameResults['title'])) { |
363 | 363 | return false; |
364 | 364 | } |
365 | - if (! empty($this->_gameResults['cover'])) { |
|
365 | + if (!empty($this->_gameResults['cover'])) { |
|
366 | 366 | $game['coverurl'] = (string) $this->_gameResults['cover']; |
367 | 367 | } |
368 | 368 | |
369 | - if (! empty($this->_gameResults['backdrop'])) { |
|
369 | + if (!empty($this->_gameResults['backdrop'])) { |
|
370 | 370 | $game['backdropurl'] = (string) $this->_gameResults['backdrop']; |
371 | 371 | } |
372 | 372 | |
@@ -374,41 +374,41 @@ discard block |
||
374 | 374 | $game['asin'] = $this->_gameResults['steamid']; |
375 | 375 | $game['url'] = (string) $this->_gameResults['directurl']; |
376 | 376 | |
377 | - if (! empty($this->_gameResults['publisher'])) { |
|
377 | + if (!empty($this->_gameResults['publisher'])) { |
|
378 | 378 | $game['publisher'] = (string) $this->_gameResults['publisher']; |
379 | 379 | } else { |
380 | 380 | $game['publisher'] = 'Unknown'; |
381 | 381 | } |
382 | 382 | |
383 | - if (! empty($this->_gameResults['rating'])) { |
|
383 | + if (!empty($this->_gameResults['rating'])) { |
|
384 | 384 | $game['esrb'] = (string) $this->_gameResults['rating']; |
385 | 385 | } else { |
386 | 386 | $game['esrb'] = 'Not Rated'; |
387 | 387 | } |
388 | 388 | |
389 | - if (! empty($this->_gameResults['releasedate'])) { |
|
389 | + if (!empty($this->_gameResults['releasedate'])) { |
|
390 | 390 | $dateReleased = strtotime($this->_gameResults['releasedate']) === false ? '' : $this->_gameResults['releasedate']; |
391 | 391 | $game['releasedate'] = ($this->_gameResults['releasedate'] === '' || strtotime($this->_gameResults['releasedate']) === false) ? null : Carbon::createFromFormat('M j, Y', Carbon::parse($dateReleased)->toFormattedDateString())->format('Y-m-d'); |
392 | 392 | } |
393 | 393 | |
394 | - if (! empty($this->_gameResults['description'])) { |
|
394 | + if (!empty($this->_gameResults['description'])) { |
|
395 | 395 | $game['review'] = (string) $this->_gameResults['description']; |
396 | 396 | } |
397 | 397 | |
398 | - if (! empty($this->_gameResults['genres'])) { |
|
398 | + if (!empty($this->_gameResults['genres'])) { |
|
399 | 399 | $genres = $this->_gameResults['genres']; |
400 | 400 | $genreName = $this->_matchGenre($genres); |
401 | 401 | } |
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | - if (! empty($this->publicKey)) { |
|
405 | + if (!empty($this->publicKey)) { |
|
406 | 406 | if ($steamGameID === false || $this->_gameResults === false) { |
407 | 407 | $bestMatch = false; |
408 | 408 | $this->_classUsed = 'GiantBomb'; |
409 | 409 | try { |
410 | 410 | $result = $this->giantBomb->search($gameInfo['title'], 'Game'); |
411 | - if (! \is_object($result)) { |
|
411 | + if (!\is_object($result)) { |
|
412 | 412 | $bestMatchPct = 0; |
413 | 413 | foreach ($result as $res) { |
414 | 414 | similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent1); |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | if ($bestMatch !== false) { |
422 | 422 | $this->_gameResults = $this->giantBomb->findWithResourceID('Game', '3030-'.$bestMatch); |
423 | 423 | |
424 | - if (! empty($this->_gameResults->image['medium_url'])) { |
|
424 | + if (!empty($this->_gameResults->image['medium_url'])) { |
|
425 | 425 | $game['coverurl'] = (string) $this->_gameResults->image['medium_url']; |
426 | 426 | } |
427 | 427 | |
428 | - if (! empty($this->_gameResults->image['screen_url'])) { |
|
428 | + if (!empty($this->_gameResults->image['screen_url'])) { |
|
429 | 429 | $game['backdropurl'] = (string) $this->_gameResults->image['screen_url']; |
430 | 430 | } |
431 | 431 | |
432 | 432 | $game['title'] = (string) $this->_gameResults->get('name'); |
433 | 433 | $game['asin'] = $this->_gameResults->get('id'); |
434 | - if (! empty($this->_gameResults->get('site_detail_url'))) { |
|
434 | + if (!empty($this->_gameResults->get('site_detail_url'))) { |
|
435 | 435 | $game['url'] = (string) $this->_gameResults->get('site_detail_url'); |
436 | 436 | } else { |
437 | 437 | $game['url'] = ''; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $game['publisher'] = 'Unknown'; |
444 | 444 | } |
445 | 445 | |
446 | - if (! empty($this->_gameResults->original_game_rating[0]['name'])) { |
|
446 | + if (!empty($this->_gameResults->original_game_rating[0]['name'])) { |
|
447 | 447 | $game['esrb'] = $this->_gameResults->original_game_rating[0]['name'] ?? 'Not Rated'; |
448 | 448 | } else { |
449 | 449 | $game['esrb'] = 'Not Rated'; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $bestMatch = false; |
481 | 481 | $this->_classUsed = 'IGDB'; |
482 | 482 | $result = Game::where('name', $gameInfo['title'])->get(); |
483 | - if (! empty($result)) { |
|
483 | + if (!empty($result)) { |
|
484 | 484 | $bestMatchPct = 0; |
485 | 485 | foreach ($result as $res) { |
486 | 486 | similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent1); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | ])->where('id', $bestMatch)->first(); |
499 | 499 | |
500 | 500 | $publishers = []; |
501 | - if (! empty($this->_gameResults->involved_companies)) { |
|
501 | + if (!empty($this->_gameResults->involved_companies)) { |
|
502 | 502 | foreach ($this->_gameResults->involved_companies as $publisher) { |
503 | 503 | if ($publisher['publisher'] === true) { |
504 | 504 | $company = Company::find($publisher['company']); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | $genres = []; |
511 | 511 | |
512 | - if (! empty($this->_gameResults->themes)) { |
|
512 | + if (!empty($this->_gameResults->themes)) { |
|
513 | 513 | foreach ($this->_gameResults->themes as $theme) { |
514 | 514 | $genres[] = $theme['name']; |
515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | 'esrb' => isset($this->_gameResults->aggregated_rating) ? round($this->_gameResults->aggregated_rating).'%' : 'Not Rated', |
532 | 532 | 'url' => $this->_gameResults->url ?? '', |
533 | 533 | 'backdropurl' => isset($this->_gameResults->screenshots) ? 'https:'.str_replace('t_thumb', 't_cover_big', $this->_gameResults->screenshots[0]['url']) : '', |
534 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
534 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
535 | 535 | ]; |
536 | 536 | } else { |
537 | 537 | $this->colorCli->notice('IGDB returned no valid results'); |
@@ -565,20 +565,20 @@ discard block |
||
565 | 565 | } else { |
566 | 566 | $game['backdrop'] = 0; |
567 | 567 | } |
568 | - if (! isset($game['trailer'])) { |
|
568 | + if (!isset($game['trailer'])) { |
|
569 | 569 | $game['trailer'] = 0; |
570 | 570 | } |
571 | 571 | if (empty($game['title'])) { |
572 | 572 | $game['title'] = $gameInfo['title']; |
573 | 573 | } |
574 | - if (! isset($game['releasedate'])) { |
|
574 | + if (!isset($game['releasedate'])) { |
|
575 | 575 | $game['releasedate'] = ''; |
576 | 576 | } |
577 | 577 | |
578 | 578 | if ($game['releasedate'] === '') { |
579 | 579 | $game['releasedate'] = ''; |
580 | 580 | } |
581 | - if (! isset($game['review'])) { |
|
581 | + if (!isset($game['review'])) { |
|
582 | 582 | $game['review'] = 'No Review'; |
583 | 583 | } |
584 | 584 | $game['classused'] = $this->_classUsed; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $game['gamesgenre'] = $genreName; |
597 | 597 | $game['gamesgenreID'] = $genreKey; |
598 | 598 | |
599 | - if (! empty($game['asin'])) { |
|
599 | + if (!empty($game['asin'])) { |
|
600 | 600 | $check = GamesInfo::query()->where('asin', $game['asin'])->first(); |
601 | 601 | if ($check === null) { |
602 | 602 | $gamesId = GamesInfo::query() |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | - if (! empty($gamesId)) { |
|
644 | + if (!empty($gamesId)) { |
|
645 | 645 | if ($this->echoOutput) { |
646 | 646 | $this->colorCli->header('Added/updated game: '). |
647 | 647 | $this->colorCli->alternateOver(' Title: '). |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $this->colorCli->primary($game['title'].' (PC)'); |
661 | 661 | } |
662 | 662 | |
663 | - return ! empty($gamesId) ? $gamesId : false; |
|
663 | + return !empty($gamesId) ? $gamesId : false; |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
@@ -82,7 +82,7 @@ |
||
82 | 82 | return $movie; |
83 | 83 | } |
84 | 84 | $sql = self::query()->select('*'); |
85 | - if (! empty($search)) { |
|
85 | + if (!empty($search)) { |
|
86 | 86 | $sql->whereLike('title', '%'.$search.'%'); |
87 | 87 | } |
88 | 88 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $this->setPreferences(); |
17 | 17 | $movie = new Movie(['Settings' => $this->settings]); |
18 | 18 | |
19 | - $moviecats = Category::getChildren(Category::MOVIE_ROOT)->map(function ($mcat) { |
|
19 | + $moviecats = Category::getChildren(Category::MOVIE_ROOT)->map(function($mcat) { |
|
20 | 20 | return ['id' => $mcat->id, 'title' => $mcat->title]; |
21 | 21 | }); |
22 | 22 | |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | |
41 | 41 | $orderby = $request->input('ob', ''); |
42 | 42 | $ordering = $movie->getMovieOrdering(); |
43 | - if (! in_array($orderby, $ordering, false)) { |
|
43 | + if (!in_array($orderby, $ordering, false)) { |
|
44 | 44 | $orderby = ''; |
45 | 45 | } |
46 | 46 | |
47 | 47 | $rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata->categoryexclusions); |
48 | 48 | $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query()); |
49 | 49 | |
50 | - $movies = $results->map(function ($result) { |
|
50 | + $movies = $results->map(function($result) { |
|
51 | 51 | $result->genre = makeFieldLinks($result, 'genre', 'movies'); |
52 | 52 | $result->actors = makeFieldLinks($result, 'actors', 'movies'); |
53 | 53 | $result->director = makeFieldLinks($result, 'director', 'movies'); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if ($request->has('id') && ctype_digit($request->input('id'))) { |
97 | 97 | $mov = $movie->getMovieInfo($request->input('id')); |
98 | 98 | |
99 | - if (! $mov) { |
|
99 | + if (!$mov) { |
|
100 | 100 | return response()->json(['message' => 'There is no trailer for this movie.'], 404); |
101 | 101 | } |
102 | 102 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | Paginator::useBootstrapFive(); |
21 | 21 | $smarty = app('smarty.view'); |
22 | 22 | view()->share('smarty', $smarty); |
23 | - Gate::define('viewPulse', function (User $user) { |
|
23 | + Gate::define('viewPulse', function(User $user) { |
|
24 | 24 | return $user->hasRole('Admin'); |
25 | 25 | }); |
26 | 26 | Event::listen(Login::class, LoginViaRemember::class); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use Illuminate\Support\Facades\DB; |
16 | 16 | |
17 | 17 | $colorCli = new ColorCLI; |
18 | -if (! isset($argv[1])) { |
|
18 | +if (!isset($argv[1])) { |
|
19 | 19 | $colorCli->error('This script is not intended to be run manually, it is called from Multiprocessing.'); |
20 | 20 | exit(); |
21 | 21 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if (preg_match('/[a-fA-F0-9]{32,40}/i', $release->name, $hits)) { |
88 | 88 | $nameFixer->matchPredbHash($hits[0], $release, true, 1, true); |
89 | 89 | } |
90 | - if ($nameFixer->matched === false && ! empty($release->filehash) && preg_match('/[a-fA-F0-9]{32,40}/i', $release->filehash, $hits)) { |
|
90 | + if ($nameFixer->matched === false && !empty($release->filehash) && preg_match('/[a-fA-F0-9]{32,40}/i', $release->filehash, $hits)) { |
|
91 | 91 | $colorCli->primaryOver('h'); |
92 | 92 | $nameFixer->matchPredbHash($hits[0], $release, true, 1, true); |
93 | 93 | } |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | } |
99 | 99 | $nameFixer->reset(); |
100 | 100 | |
101 | - if ((int) $release->proc_uid === NameFixer::PROC_UID_NONE && (! empty($release->uid) || ! empty($release->mediainfo))) { |
|
101 | + if ((int) $release->proc_uid === NameFixer::PROC_UID_NONE && (!empty($release->uid) || !empty($release->mediainfo))) { |
|
102 | 102 | $colorCli->primaryOver('U'); |
103 | - if (! empty($release->uid)) { |
|
103 | + if (!empty($release->uid)) { |
|
104 | 104 | $nameFixer->checkName($release, true, 'UID, ', 1, true); |
105 | 105 | } |
106 | - if (empty($nameFixer->matched) && ! empty($release->mediainfo)) { |
|
106 | + if (empty($nameFixer->matched) && !empty($release->mediainfo)) { |
|
107 | 107 | $nameFixer->checkName($release, true, 'Mediainfo, ', 1, true); |
108 | 108 | } |
109 | 109 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | $nameFixer->reset(); |
117 | 117 | |
118 | - if ((int) $release->proc_crc32 === NameFixer::PROC_CRC_NONE && ! empty($release->crc)) { |
|
118 | + if ((int) $release->proc_crc32 === NameFixer::PROC_CRC_NONE && !empty($release->crc)) { |
|
119 | 119 | $colorCli->primaryOver('C'); |
120 | 120 | $nameFixer->checkName($release, true, 'CRC32, ', 1, true); |
121 | 121 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | $nameFixer->reset(); |
141 | 141 | |
142 | - if ((int) $release->proc_hash16k === NameFixer::PROC_HASH16K_NONE && ! empty($release->hash)) { |
|
142 | + if ((int) $release->proc_hash16k === NameFixer::PROC_HASH16K_NONE && !empty($release->hash)) { |
|
143 | 143 | $colorCli->primaryOver('H'); |
144 | 144 | $nameFixer->checkName($release, true, 'PAR2 hash, ', 1, true); |
145 | 145 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | $nameFixer->reset(); |
153 | 153 | |
154 | - if ((int) $release->nfostatus === Nfo::NFO_FOUND && (int) $release->proc_nfo === NameFixer::PROC_NFO_NONE && ! empty($release->textstring) && ! preg_match('/^=newz\[NZB\]=\w+/', $release->textstring)) { |
|
154 | + if ((int) $release->nfostatus === Nfo::NFO_FOUND && (int) $release->proc_nfo === NameFixer::PROC_NFO_NONE && !empty($release->textstring) && !preg_match('/^=newz\[NZB\]=\w+/', $release->textstring)) { |
|
155 | 155 | $colorCli->primaryOver('n'); |
156 | 156 | $nameFixer->done = $nameFixer->matched = false; |
157 | 157 | $nameFixer->checkName($release, true, 'NFO, ', 1, true); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | if ((int) $release->proc_par2 === NameFixer::PROC_PAR2_NONE) { |
191 | 191 | $colorCli->primaryOver('p'); |
192 | - if (! isset($nzbcontents)) { |
|
192 | + if (!isset($nzbcontents)) { |
|
193 | 193 | $nntp = new NNTP; |
194 | 194 | $compressedHeaders = config('nntmux_nntp.compressed_headers'); |
195 | 195 | if ((config('nntmux_nntp.use_alternate_nntp_server') === true ? $nntp->doConnect($compressedHeaders, true) : $nntp->doConnect()) !== true) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $nzbSplitLevel = (int) Settings::settingValue('nzbsplitlevel'); |
67 | 67 | $this->nzbSplitLevel = $nzbSplitLevel ?? 1; |
68 | 68 | $this->siteNzbPath = config('nntmux_settings.path_to_nzbs'); |
69 | - if (! Str::endsWith($this->siteNzbPath, '/')) { |
|
69 | + if (!Str::endsWith($this->siteNzbPath, '/')) { |
|
70 | 70 | $this->siteNzbPath .= '/'; |
71 | 71 | } |
72 | 72 | $this->_nzbCommentString = sprintf( |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $XMLWriter->startElement('head'); |
111 | 111 | $XMLWriter->startElement('meta'); |
112 | 112 | $XMLWriter->writeAttribute('type', 'category'); |
113 | - $XMLWriter->text(! empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc'); |
|
113 | + $XMLWriter->text(!empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc'); |
|
114 | 114 | $XMLWriter->endElement(); |
115 | 115 | $XMLWriter->startElement('meta'); |
116 | 116 | $XMLWriter->writeAttribute('type', 'name'); |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | $XMLWriter->endDocument(); |
173 | 173 | $path = ($this->buildNZBPath($release->guid, $this->nzbSplitLevel, true).$release->guid.'.nzb.gz'); |
174 | 174 | $fp = gzopen($path, 'wb7'); |
175 | - if (! $fp) { |
|
175 | + if (!$fp) { |
|
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | gzwrite($fp, $XMLWriter->outputMemory()); |
179 | 179 | gzclose($fp); |
180 | 180 | unset($XMLWriter); |
181 | - if (! File::isFile($path)) { |
|
181 | + if (!File::isFile($path)) { |
|
182 | 182 | echo "ERROR: $path does not exist.\n"; |
183 | 183 | |
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | // Mark release as having NZB. |
187 | 187 | $release->update(['nzbstatus' => self::NZB_ADDED]); |
188 | - if (! empty($nzb_guid)) { |
|
188 | + if (!empty($nzb_guid)) { |
|
189 | 189 | $release->update(['nzb_guid' => DB::raw('UNHEX( '.escapeString(md5($nzb_guid)).' )')]); |
190 | 190 | } |
191 | 191 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $nzbPath = $this->siteNzbPath.$nzbPath; |
218 | 218 | |
219 | - if ($createIfNotExist && ! File::isDirectory($nzbPath) && ! File::makeDirectory($nzbPath, 0777, true) && ! File::isDirectory($nzbPath)) { |
|
219 | + if ($createIfNotExist && !File::isDirectory($nzbPath) && !File::makeDirectory($nzbPath, 0777, true) && !File::isDirectory($nzbPath)) { |
|
220 | 220 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $nzbPath)); |
221 | 221 | } |
222 | 222 | |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | $i = 0; |
273 | 273 | $result = []; |
274 | 274 | |
275 | - if (! $nzb) { |
|
275 | + if (!$nzb) { |
|
276 | 276 | return $result; |
277 | 277 | } |
278 | 278 | |
279 | 279 | $xml = @simplexml_load_string(str_replace("\x0F", '', $nzb)); |
280 | - if (! $xml || strtolower($xml->getName()) !== 'nzb') { |
|
280 | + if (!$xml || strtolower($xml->getName()) !== 'nzb') { |
|
281 | 281 | return $result; |
282 | 282 | } |
283 | 283 | |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | // Strip file / part count to get proper sorting. |
292 | 292 | $i = preg_replace('#\d+[- ._]?(/|\||[o0]f)[- ._]?\d+?(?![- ._]\d)#i', '', $i); |
293 | 293 | // Change .rar and .par2 to be sorted before .part0x.rar and .volxxx+xxx.par2 |
294 | - if (str_contains($i, '.par2') && ! preg_match('#\.vol\d+\+\d+\.par2#i', $i)) { |
|
294 | + if (str_contains($i, '.par2') && !preg_match('#\.vol\d+\+\d+\.par2#i', $i)) { |
|
295 | 295 | $i = str_replace('.par2', '.vol0.par2', $i); |
296 | - } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && ! preg_match('#\.part\d+\.rar$#i', $i)) { |
|
296 | + } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && !preg_match('#\.part\d+\.rar$#i', $i)) { |
|
297 | 297 | $i = preg_replace('#\.rar(?:[^a-z0-9])#i', '.part0.rar', $i); |
298 | 298 | } |
299 | 299 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $fileSize = $numSegments = 0; |
327 | 327 | |
328 | 328 | // Parts. |
329 | - if (! isset($result[$i]['segments'])) { |
|
329 | + if (!isset($result[$i]['segments'])) { |
|
330 | 330 | $result[$i]['segments'] = []; |
331 | 331 | } |
332 | 332 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $result[$i]['partsactual'] = $numSegments; |
346 | 346 | |
347 | 347 | // Groups. |
348 | - if (! isset($result[$i]['groups'])) { |
|
348 | + if (!isset($result[$i]['groups'])) { |
|
349 | 349 | $result[$i]['groups'] = []; |
350 | 350 | } |
351 | 351 | foreach ($file->groups->group as $g) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $this->echoCLI = config('nntmux.echocli'); |
110 | 110 | $groupID = ''; |
111 | 111 | |
112 | - if (! empty($groupName)) { |
|
112 | + if (!empty($groupName)) { |
|
113 | 113 | $groupInfo = UsenetGroup::getByName($groupName); |
114 | 114 | if ($groupInfo !== null) { |
115 | 115 | $groupID = $groupInfo['id']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); |
121 | 121 | } |
122 | 122 | |
123 | - if (! file_exists(config('nntmux_settings.path_to_nzbs'))) { |
|
123 | + if (!file_exists(config('nntmux_settings.path_to_nzbs'))) { |
|
124 | 124 | if ($this->echoCLI) { |
125 | 125 | $this->colorCLI->error('Bad or missing nzb directory - '.config('nntmux_settings.path_to_nzbs')); |
126 | 126 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $cat = new Categorize; |
182 | 182 | $categorized = $total = 0; |
183 | 183 | $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]); |
184 | - if (! empty($groupId)) { |
|
184 | + if (!empty($groupId)) { |
|
185 | 185 | $releasesQuery->where('groups_id', $groupId); |
186 | 186 | } |
187 | 187 | $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get(); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->colorCLI->header('Process Releases -> Attempting to find complete collections.'); |
218 | 218 | } |
219 | 219 | |
220 | - $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
220 | + $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
221 | 221 | |
222 | 222 | $this->processStuckCollections($groupID); |
223 | 223 | $this->collectionFileCheckStage1($groupID); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ($this->echoCLI) { |
231 | 231 | $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART); |
232 | 232 | |
233 | - if (! empty($groupID)) { |
|
233 | + if (!empty($groupID)) { |
|
234 | 234 | $countQuery->where('groups_id', $groupID); |
235 | 235 | } |
236 | 236 | $count = $countQuery->count('id'); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).'); |
258 | 258 | } |
259 | 259 | // Get the total size in bytes of the collection for collections where filecheck = 2. |
260 | - DB::transaction(function () use ($groupID, $startTime) { |
|
260 | + DB::transaction(function() use ($groupID, $startTime) { |
|
261 | 261 | $checked = DB::update( |
262 | 262 | sprintf( |
263 | 263 | ' |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | AND c.filesize = 0 %s', |
274 | 274 | self::COLLFC_SIZED, |
275 | 275 | self::COLLFC_COMPPART, |
276 | - (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
276 | + (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | if ($checked > 0 && $this->echoCLI) { |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | |
313 | 313 | $groupMinimums = UsenetGroup::getGroupByID($grpID['id']); |
314 | 314 | if ($groupMinimums !== null) { |
315 | - if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
315 | + if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
316 | 316 | $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease']; |
317 | 317 | } |
318 | - if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
318 | + if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
319 | 319 | $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease']; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) { |
324 | - DB::transaction(function () use ( |
|
324 | + DB::transaction(function() use ( |
|
325 | 325 | $groupMinSizeSetting, |
326 | 326 | $minSizeSetting, |
327 | 327 | $minSizeDeleted, |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $collectionsQuery = Collection::query() |
394 | 394 | ->where('collections.filecheck', self::COLLFC_SIZED) |
395 | 395 | ->where('collections.filesize', '>', 0); |
396 | - if (! empty($groupID)) { |
|
396 | + if (!empty($groupID)) { |
|
397 | 397 | $collectionsQuery->where('collections.groups_id', $groupID); |
398 | 398 | } |
399 | 399 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $releaseID = Release::insertRelease( |
449 | 449 | [ |
450 | 450 | 'name' => $cleanRelName, |
451 | - 'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
451 | + 'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
452 | 452 | 'totalpart' => $collection->totalfiles, |
453 | 453 | 'groups_id' => $collection->groups_id, |
454 | 454 | 'guid' => createGUID(), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | if ($releaseID !== null) { |
466 | 466 | // Update collections table to say we inserted the release. |
467 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
467 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
468 | 468 | Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); |
469 | 469 | }, 10); |
470 | 470 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | } else { |
527 | 527 | // The release was already in the DB, so delete the collection. |
528 | - DB::transaction(static function () use ($collection) { |
|
528 | + DB::transaction(static function() use ($collection) { |
|
529 | 529 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
530 | 530 | }, 10); |
531 | 531 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0); |
569 | - if (! empty($groupID)) { |
|
569 | + if (!empty($groupID)) { |
|
570 | 570 | $releasesQuery->where('releases.groups_id', $groupID); |
571 | 571 | } |
572 | 572 | $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get(); |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | ), true); |
670 | 670 | } |
671 | 671 | |
672 | - DB::transaction(function () use ($deletedCount, $startTime) { |
|
672 | + DB::transaction(function() use ($deletedCount, $startTime) { |
|
673 | 673 | $deleted = 0; |
674 | 674 | $deleteQuery = Collection::query() |
675 | 675 | ->where('dateadded', '<', now()->subHours(Settings::settingValue('partretentionhours'))) |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $releases = Release::query() |
833 | 833 | ->select(['id', 'guid']) |
834 | 834 | ->where('passwordstatus', '=', Releases::PASSWD_RAR) |
835 | - ->orWhereIn('id', function ($query) { |
|
835 | + ->orWhereIn('id', function($query) { |
|
836 | 836 | $query->select('releases_id') |
837 | 837 | ->from('release_files') |
838 | 838 | ->where('passworded', '=', Releases::PASSWD_RAR); |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | foreach ($genrelist as $genre) { |
892 | 892 | $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']); |
893 | 893 | $releases = Release::query() |
894 | - ->joinSub($musicInfoQuery, 'mi', function ($join) { |
|
894 | + ->joinSub($musicInfoQuery, 'mi', function($join) { |
|
895 | 895 | $join->on('releases.musicinfo_id', '=', 'mi.id'); |
896 | 896 | }) |
897 | 897 | ->select(['releases.id', 'releases.guid']) |
@@ -977,18 +977,18 @@ discard block |
||
977 | 977 | */ |
978 | 978 | private function collectionFileCheckStage1(int $groupID): void |
979 | 979 | { |
980 | - DB::transaction(static function () use ($groupID) { |
|
980 | + DB::transaction(static function() use ($groupID) { |
|
981 | 981 | $collectionsCheck = Collection::query()->select(['collections.id']) |
982 | 982 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
983 | 983 | ->where('collections.totalfiles', '>', 0) |
984 | 984 | ->where('collections.filecheck', '=', self::COLLFC_DEFAULT); |
985 | - if (! empty($groupID)) { |
|
985 | + if (!empty($groupID)) { |
|
986 | 986 | $collectionsCheck->where('collections.groups_id', $groupID); |
987 | 987 | } |
988 | 988 | $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id') |
989 | 989 | ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)'); |
990 | 990 | |
991 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
991 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
992 | 992 | $join->on('collections.id', '=', 'r.id'); |
993 | 993 | })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]); |
994 | 994 | }, 10); |
@@ -1009,25 +1009,25 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | private function collectionFileCheckStage2(int $groupID): void |
1011 | 1011 | { |
1012 | - DB::transaction(static function () use ($groupID) { |
|
1012 | + DB::transaction(static function() use ($groupID) { |
|
1013 | 1013 | $collectionsCheck = Collection::query()->select(['collections.id']) |
1014 | 1014 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
1015 | 1015 | ->where('binaries.filenumber', '=', 0) |
1016 | 1016 | ->where('collections.totalfiles', '>', 0) |
1017 | 1017 | ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL); |
1018 | - if (! empty($groupID)) { |
|
1018 | + if (!empty($groupID)) { |
|
1019 | 1019 | $collectionsCheck->where('collections.groups_id', $groupID); |
1020 | 1020 | } |
1021 | 1021 | $collectionsCheck->groupBy('collections.id'); |
1022 | 1022 | |
1023 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
1023 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
1024 | 1024 | $join->on('collections.id', '=', 'r.id'); |
1025 | 1025 | })->update(['collections.filecheck' => self::COLLFC_ZEROPART]); |
1026 | 1026 | }, 10); |
1027 | 1027 | |
1028 | - DB::transaction(static function () use ($groupID) { |
|
1028 | + DB::transaction(static function() use ($groupID) { |
|
1029 | 1029 | $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL); |
1030 | - if (! empty($groupID)) { |
|
1030 | + if (!empty($groupID)) { |
|
1031 | 1031 | $collectionQuery->where('groups_id', $groupID); |
1032 | 1032 | } |
1033 | 1033 | $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]); |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | private function collectionFileCheckStage3(string $where): void |
1047 | 1047 | { |
1048 | - DB::transaction(static function () use ($where) { |
|
1048 | + DB::transaction(static function() use ($where) { |
|
1049 | 1049 | DB::update( |
1050 | 1050 | sprintf( |
1051 | 1051 | ' |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | ); |
1070 | 1070 | }, 10); |
1071 | 1071 | |
1072 | - DB::transaction(static function () use ($where) { |
|
1072 | + DB::transaction(static function() use ($where) { |
|
1073 | 1073 | DB::update( |
1074 | 1074 | sprintf( |
1075 | 1075 | ' |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | */ |
1107 | 1107 | private function collectionFileCheckStage4(string &$where): void |
1108 | 1108 | { |
1109 | - DB::transaction(static function () use ($where) { |
|
1109 | + DB::transaction(static function() use ($where) { |
|
1110 | 1110 | DB::update( |
1111 | 1111 | sprintf( |
1112 | 1112 | ' |
@@ -1136,9 +1136,9 @@ discard block |
||
1136 | 1136 | */ |
1137 | 1137 | private function collectionFileCheckStage5(int $groupId): void |
1138 | 1138 | { |
1139 | - DB::transaction(static function () use ($groupId) { |
|
1139 | + DB::transaction(static function() use ($groupId) { |
|
1140 | 1140 | $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]); |
1141 | - if (! empty($groupId)) { |
|
1141 | + if (!empty($groupId)) { |
|
1142 | 1142 | $collectionQuery->where('groups_id', $groupId); |
1143 | 1143 | } |
1144 | 1144 | $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]); |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | */ |
1157 | 1157 | private function collectionFileCheckStage6(string &$where): void |
1158 | 1158 | { |
1159 | - DB::transaction(function () use ($where) { |
|
1159 | + DB::transaction(function() use ($where) { |
|
1160 | 1160 | DB::update( |
1161 | 1161 | sprintf( |
1162 | 1162 | " |
@@ -1186,10 +1186,10 @@ discard block |
||
1186 | 1186 | { |
1187 | 1187 | $lastRun = Settings::settingValue('last_run_time'); |
1188 | 1188 | |
1189 | - DB::transaction(function () use ($groupID, $lastRun) { |
|
1189 | + DB::transaction(function() use ($groupID, $lastRun) { |
|
1190 | 1190 | $objQuery = Collection::query() |
1191 | 1191 | ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout)); |
1192 | - if (! empty($groupID)) { |
|
1192 | + if (!empty($groupID)) { |
|
1193 | 1193 | $objQuery->where('groups_id', $groupID); |
1194 | 1194 | } |
1195 | 1195 | $obj = $objQuery->delete(); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | $this->_addPAR2Files = config('nntmux:settings.add_par2'); |
333 | 333 | |
334 | - if (! config('nntmux_settings.ffmpeg_path')) { |
|
334 | + if (!config('nntmux_settings.ffmpeg_path')) { |
|
335 | 335 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
336 | 336 | } else { |
337 | 337 | $this->_processAudioSample = (int) Settings::settingValue('saveaudiopreview') !== 0; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $this->_processJPGSample = (int) Settings::settingValue('processjpg') !== 0; |
343 | 343 | $this->_processMediaInfo = config('nntmux_settings.mediainfo_path'); |
344 | 344 | $this->_processAudioInfo = $this->_processMediaInfo; |
345 | - $this->_processPasswords = config('nntmux_settings.check_passworded_rars') === true && ! empty(config('nntmux_settings.unrar_path')); |
|
345 | + $this->_processPasswords = config('nntmux_settings.check_passworded_rars') === true && !empty(config('nntmux_settings.unrar_path')); |
|
346 | 346 | |
347 | 347 | $this->_audioSavePath = config('nntmux_settings.covers_path').'/audiosample/'; |
348 | 348 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $this->_mainTmpPath = config('nntmux.tmp_unrar_path'); |
400 | 400 | |
401 | 401 | // Check if it ends with a dir separator. |
402 | - if (! Str::endsWith($this->_mainTmpPath, '/') && ! Str::endsWith($this->_mainTmpPath, '\\')) { |
|
402 | + if (!Str::endsWith($this->_mainTmpPath, '/') && !Str::endsWith($this->_mainTmpPath, '\\')) { |
|
403 | 403 | $this->_mainTmpPath .= '/'; |
404 | 404 | } |
405 | 405 | |
@@ -410,13 +410,13 @@ discard block |
||
410 | 410 | $this->_mainTmpPath .= $guidChar.'/'; |
411 | 411 | } |
412 | 412 | |
413 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
414 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
413 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
414 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
415 | 415 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
419 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
420 | 420 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
421 | 421 | } |
422 | 422 | |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | if ($this->_minSize > 0) { |
455 | 455 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
456 | 456 | } |
457 | - if (! empty($groupID)) { |
|
457 | + if (!empty($groupID)) { |
|
458 | 458 | $releasesQuery->where('releases.groups_id', $groupID); |
459 | 459 | } |
460 | - if (! empty($guidChar)) { |
|
460 | + if (!empty($guidChar)) { |
|
461 | 461 | $releasesQuery->where('releases.leftguid', $guidChar); |
462 | 462 | } |
463 | 463 | $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']) |
@@ -511,12 +511,12 @@ discard block |
||
511 | 511 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
512 | 512 | |
513 | 513 | // Create folder to store temporary files. |
514 | - if (! $this->_createTempFolder()) { |
|
514 | + if (!$this->_createTempFolder()) { |
|
515 | 515 | continue; |
516 | 516 | } |
517 | 517 | |
518 | 518 | // Get NZB contents. |
519 | - if (! $this->_getNZBContents()) { |
|
519 | + if (!$this->_getNZBContents()) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $this->_processMessageIDDownloads(); |
539 | 539 | |
540 | 540 | // Process compressed (RAR/ZIP) files inside the NZB. |
541 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
541 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
542 | 542 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
543 | 543 | $this->_processNZBCompressedFiles(); |
544 | 544 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $this->_processNZBCompressedFiles(true); |
548 | 548 | } |
549 | 549 | |
550 | - if (! $this->_releaseHasPassword) { |
|
550 | + if (!$this->_releaseHasPassword) { |
|
551 | 551 | // Process the extracted files to get video/audio samples/etc. |
552 | 552 | $this->_processExtractedFiles(); |
553 | 553 | } |
@@ -591,10 +591,10 @@ discard block |
||
591 | 591 | { |
592 | 592 | // Per release defaults. |
593 | 593 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
594 | - if (! File::isDirectory($this->tmpPath)) { |
|
595 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
594 | + if (!File::isDirectory($this->tmpPath)) { |
|
595 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
596 | 596 | // We will try to create the main temp folder again, just in case there was a file lock or filesystem issue. |
597 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
597 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
598 | 598 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
599 | 599 | |
600 | 600 | return false; |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
617 | 617 | if ($nzbPath !== false) { |
618 | 618 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
619 | - if (! $nzbContents) { |
|
619 | + if (!$nzbContents) { |
|
620 | 620 | if ($this->_echoCLI) { |
621 | 621 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
622 | 622 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | } |
678 | 678 | |
679 | 679 | // Check if it's a rar/zip. |
680 | - if (! $this->_NZBHasCompressedFile && |
|
680 | + if (!$this->_NZBHasCompressedFile && |
|
681 | 681 | preg_match( |
682 | 682 | '/\.(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', |
683 | 683 | $this->_currentNZBFile['title'] |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | // Look for a video sample, make sure it's not an image. |
690 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
690 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
691 | 691 | ) { |
692 | 692 | // Get the amount of segments for this file. |
693 | 693 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | } |
702 | 702 | |
703 | 703 | // Look for a JPG picture, make sure it's not a CD cover. |
704 | - 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']) |
|
704 | + 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']) |
|
705 | 705 | ) { |
706 | 706 | // Get the amount of segments for this file. |
707 | 707 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $this->_reverse = $reverse; |
754 | 754 | |
755 | 755 | if ($this->_reverse) { |
756 | - if (! krsort($this->_nzbContents)) { |
|
756 | + if (!krsort($this->_nzbContents)) { |
|
757 | 757 | return; |
758 | 758 | } |
759 | 759 | } else { |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } |
778 | 778 | |
779 | 779 | // Probably not a rar/zip. |
780 | - if (! preg_match( |
|
780 | + if (!preg_match( |
|
781 | 781 | '/\.(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', |
782 | 782 | $nzbFile['title'] |
783 | 783 | ) |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | break; |
794 | 794 | } |
795 | 795 | $segment = (string) $nzbFile['segments'][$i]; |
796 | - if (! $this->_reverse) { |
|
796 | + if (!$this->_reverse) { |
|
797 | 797 | $this->_triedCompressedMids[] = $segment; |
798 | 798 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
799 | 799 | // We already downloaded this file. |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | { |
846 | 846 | $this->_compressedFilesChecked++; |
847 | 847 | // Give the data to archive info, so it can check if it's a rar. |
848 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
848 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
849 | 849 | if (config('app.debug') === true) { |
850 | 850 | $this->_debug('Data is probably not RAR or ZIP.'); |
851 | 851 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | } |
876 | 876 | |
877 | 877 | // Check if the compressed file is encrypted. |
878 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
878 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
879 | 879 | if (config('app.debug') === true) { |
880 | 880 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
881 | 881 | } |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | |
888 | 888 | if ($this->_reverse) { |
889 | 889 | $fileData = $dataSummary['file_list'] ?? []; |
890 | - if (! empty($fileData)) { |
|
890 | + if (!empty($fileData)) { |
|
891 | 891 | $rarFileName = Arr::pluck($fileData, 'name'); |
892 | 892 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
893 | 893 | $preCheck = Predb::whereTitle($hit[0])->first(); |
894 | 894 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
895 | 895 | (new NameFixer)->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
896 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
896 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
897 | 897 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
898 | 898 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
899 | 899 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $this->_echo('r', 'primaryOver'); |
912 | 912 | } |
913 | 913 | |
914 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
914 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
915 | 915 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
916 | 916 | File::put($fileName, $compressedData); |
917 | 917 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | if ($this->_echoCLI) { |
923 | 923 | $this->_echo('z', 'primaryOver'); |
924 | 924 | } |
925 | - if (! $this->_extractUsingRarInfo) { |
|
925 | + if (!$this->_extractUsingRarInfo) { |
|
926 | 926 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
927 | 927 | File::put($fileName, $compressedData); |
928 | 928 | // Use the unzip command instead of 7zip |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | { |
948 | 948 | // Get a list of files inside the Compressed file. |
949 | 949 | $files = $this->_archiveInfo->getArchiveFileList(); |
950 | - if (! \is_array($files) || \count($files) === 0) { |
|
950 | + if (!\is_array($files) || \count($files) === 0) { |
|
951 | 951 | return false; |
952 | 952 | } |
953 | 953 | |
@@ -1017,8 +1017,8 @@ discard block |
||
1017 | 1017 | protected function _addFileInfo(&$file): void |
1018 | 1018 | { |
1019 | 1019 | // Don't add rar/zip files to the DB. |
1020 | - if (! isset($file['error']) && isset($file['source']) && |
|
1021 | - ! 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']) |
|
1020 | + if (!isset($file['error']) && isset($file['source']) && |
|
1021 | + !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']) |
|
1022 | 1022 | ) { |
1023 | 1023 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
1024 | 1024 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | */ |
1030 | 1030 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
1031 | 1031 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
1032 | - if (! empty($addReleaseFiles)) { |
|
1032 | + if (!empty($addReleaseFiles)) { |
|
1033 | 1033 | $this->_addedFileInfo++; |
1034 | 1034 | |
1035 | 1035 | if ($this->_echoCLI) { |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | $this->_releaseHasPassword = true; |
1045 | 1045 | $this->_passwordStatus = Releases::PASSWD_RAR; |
1046 | 1046 | } //Run a PreDB filename check on insert to try and match the release |
1047 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
1047 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
1048 | 1048 | $this->_release['filename'] = $file['name']; |
1049 | 1049 | $this->_release['releases_id'] = $this->_release->id; |
1050 | 1050 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1075,12 +1075,12 @@ discard block |
||
1075 | 1075 | // Get all the compressed files in the temp folder. |
1076 | 1076 | $files = $this->_getTempDirectoryContents('/.*\.([rz]\d{2,}|rar|zipx?|0{0,2}1)($|[^a-z0-9])/i'); |
1077 | 1077 | |
1078 | - if (! empty($files)) { |
|
1078 | + if (!empty($files)) { |
|
1079 | 1079 | foreach ($files as $file) { |
1080 | 1080 | // Check if the file exists. |
1081 | 1081 | if (File::isFile($file[0])) { |
1082 | 1082 | $rarData = @File::get($file[0]); |
1083 | - if (! empty($rarData)) { |
|
1083 | + if (!empty($rarData)) { |
|
1084 | 1084 | $this->_processCompressedData($rarData); |
1085 | 1085 | $foundCompressedFile = true; |
1086 | 1086 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | // If we found no compressed files, break out. |
1093 | - if (! $foundCompressedFile) { |
|
1093 | + if (!$foundCompressedFile) { |
|
1094 | 1094 | break; |
1095 | 1095 | } |
1096 | 1096 | |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | |
1102 | 1102 | // Get all the remaining files in the temp dir. |
1103 | 1103 | $files = $this->_getTempDirectoryContents(); |
1104 | - if (! empty($files)) { |
|
1104 | + if (!empty($files)) { |
|
1105 | 1105 | foreach ($files as $file) { |
1106 | 1106 | $file = $file->getPathname(); |
1107 | 1107 | |
@@ -1112,39 +1112,39 @@ discard block |
||
1112 | 1112 | |
1113 | 1113 | if (File::isFile($file)) { |
1114 | 1114 | // Process PAR2 files. |
1115 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1115 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1116 | 1116 | $this->_siftPAR2Info($file); |
1117 | 1117 | } // Process NFO files. |
1118 | 1118 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
1119 | 1119 | $this->_processNfoFile($file); |
1120 | 1120 | } // Process audio files. |
1121 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1121 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1122 | 1122 | // Try to get audio sample/audio media info. |
1123 | 1123 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
1124 | 1124 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
1125 | 1125 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
1126 | 1126 | } // Process JPG files. |
1127 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1127 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1128 | 1128 | $this->_getJPGSample($file); |
1129 | 1129 | File::delete($file); |
1130 | 1130 | } // Video sample // video clip // video media info. |
1131 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1131 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1132 | 1132 | $this->_processVideoFile($file); |
1133 | 1133 | } // Check file's magic info. |
1134 | 1134 | else { |
1135 | 1135 | $output = Utility::fileInfo($file); |
1136 | - if (! empty($output)) { |
|
1136 | + if (!empty($output)) { |
|
1137 | 1137 | switch (true) { |
1138 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1138 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1139 | 1139 | $this->_getJPGSample($file); |
1140 | 1140 | File::delete($file); |
1141 | 1141 | break; |
1142 | 1142 | |
1143 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1143 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1144 | 1144 | $this->_processVideoFile($file); |
1145 | 1145 | break; |
1146 | 1146 | |
1147 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1147 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1148 | 1148 | switch ($fileType[0]) { |
1149 | 1149 | case 'FLAC': |
1150 | 1150 | $fileType = 'FLAC'; |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
1162 | 1162 | break; |
1163 | 1163 | |
1164 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1164 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1165 | 1165 | $this->_siftPAR2Info($file); |
1166 | 1166 | break; |
1167 | 1167 | } |
@@ -1197,8 +1197,8 @@ discard block |
||
1197 | 1197 | protected function _processSampleMessageIDs(): void |
1198 | 1198 | { |
1199 | 1199 | // Download and process sample image. |
1200 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
1201 | - if (! empty($this->_sampleMessageIDs)) { |
|
1200 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
1201 | + if (!empty($this->_sampleMessageIDs)) { |
|
1202 | 1202 | // Download it from usenet. |
1203 | 1203 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
1204 | 1204 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | File::put($fileLocation, $sampleBinary); |
1218 | 1218 | |
1219 | 1219 | // Try to get a sample picture. |
1220 | - if (! $this->_foundSample) { |
|
1220 | + if (!$this->_foundSample) { |
|
1221 | 1221 | $this->_foundSample = $this->_getSample($fileLocation); |
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | // Try to get a sample video. |
1225 | - if (! $this->_foundVideo) { |
|
1225 | + if (!$this->_foundVideo) { |
|
1226 | 1226 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1227 | 1227 | } |
1228 | 1228 | } |
@@ -1243,8 +1243,8 @@ discard block |
||
1243 | 1243 | protected function _processMediaInfoMessageIDs(): void |
1244 | 1244 | { |
1245 | 1245 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
1246 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
1247 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
1246 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
1247 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
1248 | 1248 | // Try to download it from usenet. |
1249 | 1249 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
1250 | 1250 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1264,17 +1264,17 @@ discard block |
||
1264 | 1264 | File::put($fileLocation, $mediaBinary); |
1265 | 1265 | |
1266 | 1266 | // Try to get media info. |
1267 | - if (! $this->_foundMediaInfo) { |
|
1267 | + if (!$this->_foundMediaInfo) { |
|
1268 | 1268 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | // Try to get a sample picture. |
1272 | - if (! $this->_foundSample) { |
|
1272 | + if (!$this->_foundSample) { |
|
1273 | 1273 | $this->_foundSample = $this->_getSample($fileLocation); |
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | // Try to get a sample video. |
1277 | - if (! $this->_foundVideo) { |
|
1277 | + if (!$this->_foundVideo) { |
|
1278 | 1278 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1279 | 1279 | } |
1280 | 1280 | } |
@@ -1295,8 +1295,8 @@ discard block |
||
1295 | 1295 | protected function _processAudioInfoMessageIDs(): void |
1296 | 1296 | { |
1297 | 1297 | // Download audio file, use media info to try to get the artist / album. |
1298 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
1299 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
1298 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
1299 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
1300 | 1300 | // Try to download it from usenet. |
1301 | 1301 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
1302 | 1302 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | protected function _processJPGMessageIDs(): void |
1332 | 1332 | { |
1333 | 1333 | // Download JPG file. |
1334 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
1334 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
1335 | 1335 | // Try to download it. |
1336 | 1336 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
1337 | 1337 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1400,12 +1400,12 @@ discard block |
||
1400 | 1400 | $this->_passwordStatus = max([$this->_passwordStatus]); |
1401 | 1401 | |
1402 | 1402 | // Set the release to no password if password processing is off. |
1403 | - if (! $this->_processPasswords) { |
|
1403 | + if (!$this->_processPasswords) { |
|
1404 | 1404 | $this->_releaseHasPassword = false; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // If we failed to get anything from the RAR/ZIPs update the release with what we have, if the rar/zip has no password. |
1408 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1408 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1409 | 1409 | $release = Release::query()->where('id', $this->_release->id); |
1410 | 1410 | $release->update( |
1411 | 1411 | $updateRows |
@@ -1459,19 +1459,19 @@ discard block |
||
1459 | 1459 | $retVal = $audVal = false; |
1460 | 1460 | |
1461 | 1461 | // Check if audio sample fetching is on. |
1462 | - if (! $this->_processAudioSample) { |
|
1462 | + if (!$this->_processAudioSample) { |
|
1463 | 1463 | $audVal = true; |
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | // Check if media info fetching is on. |
1467 | - if (! $this->_processAudioInfo) { |
|
1467 | + if (!$this->_processAudioInfo) { |
|
1468 | 1468 | $retVal = true; |
1469 | 1469 | } |
1470 | 1470 | |
1471 | 1471 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
1472 | 1472 | |
1473 | 1473 | $musicParent = (string) Category::MUSIC_ROOT; |
1474 | - if ($rQuery === null || ! preg_match( |
|
1474 | + if ($rQuery === null || !preg_match( |
|
1475 | 1475 | sprintf( |
1476 | 1476 | '/%d\d{3}|%d|%d|%d/', |
1477 | 1477 | $musicParent[0], |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | |
1488 | 1488 | if (File::isFile($fileLocation)) { |
1489 | 1489 | // Check if media info is enabled. |
1490 | - if (! $retVal) { |
|
1490 | + if (!$retVal) { |
|
1491 | 1491 | // Get the media info for the file. |
1492 | 1492 | try { |
1493 | 1493 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | $ext = strtoupper($fileExtension); |
1501 | 1501 | |
1502 | 1502 | // Form a new search name. |
1503 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1503 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1504 | 1504 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
1505 | 1505 | } else { |
1506 | 1506 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | } |
1563 | 1563 | |
1564 | 1564 | // Check if creating audio samples is enabled. |
1565 | - if (! $audVal) { |
|
1565 | + if (!$audVal) { |
|
1566 | 1566 | // File name to store audio file. |
1567 | 1567 | $audioFileName = ($this->_release->guid.'.ogg'); |
1568 | 1568 | |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | // Try to move the temp audio file. |
1587 | 1587 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1588 | 1588 | |
1589 | - if (! $renamed) { |
|
1589 | + if (!$renamed) { |
|
1590 | 1590 | // Try to copy it if it fails. |
1591 | 1591 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1592 | 1592 | |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | File::delete($this->tmpPath.$audioFileName); |
1595 | 1595 | |
1596 | 1596 | // If it didn't copy continue. |
1597 | - if (! $copied) { |
|
1597 | + if (!$copied) { |
|
1598 | 1598 | return false; |
1599 | 1599 | } |
1600 | 1600 | } |
@@ -1646,7 +1646,7 @@ discard block |
||
1646 | 1646 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
1647 | 1647 | } |
1648 | 1648 | |
1649 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1649 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1650 | 1650 | return ''; |
1651 | 1651 | } |
1652 | 1652 | |
@@ -1667,7 +1667,7 @@ discard block |
||
1667 | 1667 | */ |
1668 | 1668 | protected function _getSample(string $fileLocation): bool |
1669 | 1669 | { |
1670 | - if (! $this->_processThumbnails) { |
|
1670 | + if (!$this->_processThumbnails) { |
|
1671 | 1671 | return false; |
1672 | 1672 | } |
1673 | 1673 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | */ |
1733 | 1733 | protected function _getVideo(string $fileLocation): bool |
1734 | 1734 | { |
1735 | - if (! $this->_processVideo) { |
|
1735 | + if (!$this->_processVideo) { |
|
1736 | 1736 | return false; |
1737 | 1737 | } |
1738 | 1738 | |
@@ -1787,7 +1787,7 @@ discard block |
||
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | // If longer than 60 or we could not get the video length, run the old way. |
1790 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1790 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1791 | 1791 | try { |
1792 | 1792 | $video = $this->ffmpeg->open($fileLocation); |
1793 | 1793 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1810,14 +1810,14 @@ discard block |
||
1810 | 1810 | |
1811 | 1811 | // Try to move the file to the new path. |
1812 | 1812 | // If we couldn't rename it, try to copy it. |
1813 | - if (! @File::move($fileName, $newFile)) { |
|
1813 | + if (!@File::move($fileName, $newFile)) { |
|
1814 | 1814 | $copied = @File::copy($fileName, $newFile); |
1815 | 1815 | |
1816 | 1816 | // Delete the old file. |
1817 | 1817 | File::delete($fileName); |
1818 | 1818 | |
1819 | 1819 | // If it didn't copy, continue. |
1820 | - if (! $copied) { |
|
1820 | + if (!$copied) { |
|
1821 | 1821 | return false; |
1822 | 1822 | } |
1823 | 1823 | } |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | */ |
1844 | 1844 | protected function _getMediaInfo($fileLocation): bool |
1845 | 1845 | { |
1846 | - if (! $this->_processMediaInfo) { |
|
1846 | + if (!$this->_processMediaInfo) { |
|
1847 | 1847 | return false; |
1848 | 1848 | } |
1849 | 1849 | |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | $filesAdded = 0; |
1913 | 1913 | |
1914 | 1914 | foreach ($this->_par2Info->getFileList() as $file) { |
1915 | - if (! isset($file['name'])) { |
|
1915 | + if (!isset($file['name'])) { |
|
1916 | 1916 | continue; |
1917 | 1917 | } |
1918 | 1918 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | } |
1936 | 1936 | |
1937 | 1937 | // Try to get a new name. |
1938 | - if (! $foundName) { |
|
1938 | + if (!$foundName) { |
|
1939 | 1939 | $this->_release->textstring = $file['name']; |
1940 | 1940 | $this->_release->releases_id = $this->_release->id; |
1941 | 1941 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | protected function _processVideoFile($fileLocation): void |
1966 | 1966 | { |
1967 | 1967 | // Try to get a sample with it. |
1968 | - if (! $this->_foundSample) { |
|
1968 | + if (!$this->_foundSample) { |
|
1969 | 1969 | $this->_foundSample = $this->_getSample($fileLocation); |
1970 | 1970 | } |
1971 | 1971 | |
@@ -1973,12 +1973,12 @@ discard block |
||
1973 | 1973 | * Don't get it here if _sampleMessageIDs is empty |
1974 | 1974 | * or has 1 message-id (Saves downloading another part). |
1975 | 1975 | */ |
1976 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
1976 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
1977 | 1977 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | // Try to get media info with it. |
1981 | - if (! $this->_foundMediaInfo) { |
|
1981 | + if (!$this->_foundMediaInfo) { |
|
1982 | 1982 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
1983 | 1983 | } |
1984 | 1984 | } |
@@ -2000,24 +2000,24 @@ discard block |
||
2000 | 2000 | $bf = true; |
2001 | 2001 | } |
2002 | 2002 | |
2003 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2003 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2004 | 2004 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
2005 | 2005 | $af = true; |
2006 | 2006 | } |
2007 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2007 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2008 | 2008 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
2009 | 2009 | $bf = true; |
2010 | 2010 | } |
2011 | 2011 | |
2012 | - if (! $af && ! $bf) { |
|
2012 | + if (!$af && !$bf) { |
|
2013 | 2013 | return strnatcasecmp($a, $b); |
2014 | 2014 | } |
2015 | 2015 | |
2016 | - if (! $bf) { |
|
2016 | + if (!$bf) { |
|
2017 | 2017 | return -1; |
2018 | 2018 | } |
2019 | 2019 | |
2020 | - if (! $af) { |
|
2020 | + if (!$af) { |
|
2021 | 2021 | return 1; |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2042,12 +2042,12 @@ discard block |
||
2042 | 2042 | protected function _resetReleaseStatus(): void |
2043 | 2043 | { |
2044 | 2044 | // Only process for samples, previews and images if not disabled. |
2045 | - $this->_foundVideo = ! $this->_processVideo; |
|
2046 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
2047 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
2048 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
2049 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
2050 | - $this->_foundSample = ! $this->_processThumbnails; |
|
2045 | + $this->_foundVideo = !$this->_processVideo; |
|
2046 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
2047 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
2048 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
2049 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
2050 | + $this->_foundSample = !$this->_processThumbnails; |
|
2051 | 2051 | $this->_foundPAR2Info = false; |
2052 | 2052 | |
2053 | 2053 | $this->_passwordStatus = Releases::PASSWD_NONE; |