@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | GROUP BY r.id |
276 | 276 | ORDER BY %s %s %s", |
277 | 277 | $this->uSQL($userShows, 'videos_id'), |
278 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
278 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
279 | 279 | NZB::NZB_ADDED, |
280 | 280 | Category::TV_ROOT, |
281 | 281 | Category::TV_OTHER, |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | { |
346 | 346 | // Delete NZB from disk. |
347 | 347 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
348 | - if (! empty($nzbPath)) { |
|
348 | + if (!empty($nzbPath)) { |
|
349 | 349 | File::delete($nzbPath); |
350 | 350 | } |
351 | 351 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
387 | 387 | { |
388 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
388 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | $sql = '(1=2 '; |
410 | 410 | foreach ($userQuery as $query) { |
411 | 411 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
412 | - if (! empty($query->categories)) { |
|
412 | + if (!empty($query->categories)) { |
|
413 | 413 | $catsArr = explode('|', $query->categories); |
414 | 414 | if (\count($catsArr) > 1) { |
415 | 415 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $orderBy = $this->getBrowseOrder($orderBy); |
454 | 454 | } |
455 | 455 | |
456 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
456 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
457 | 457 | return $value !== -1; |
458 | 458 | }); |
459 | 459 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
464 | 464 | } else { |
465 | 465 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
466 | - if (! empty($searchResult)) { |
|
466 | + if (!empty($searchResult)) { |
|
467 | 467 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
468 | 468 | } |
469 | 469 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
555 | 555 | } else { |
556 | 556 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
557 | - if (! empty($searchResult)) { |
|
557 | + if (!empty($searchResult)) { |
|
558 | 558 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
559 | 559 | } |
560 | 560 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
571 | 571 | $catQuery, |
572 | 572 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
573 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
573 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
574 | 574 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
575 | 575 | ); |
576 | 576 | $baseSql = sprintf( |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | if ($releases !== null) { |
605 | 605 | return $releases; |
606 | 606 | } |
607 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
607 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
608 | 608 | $releases = self::fromQuery($sql); |
609 | 609 | } elseif ($searchName !== -1 && empty($searchResult)) { |
610 | 610 | $releases = collect(); |
@@ -658,11 +658,11 @@ discard block |
||
658 | 658 | $show = self::fromQuery($showQry); |
659 | 659 | |
660 | 660 | if ($show->isNotEmpty()) { |
661 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
661 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
662 | 662 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
663 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
663 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
664 | 664 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
665 | - } elseif (! empty($series) && empty($episode)) { |
|
665 | + } elseif (!empty($series) && empty($episode)) { |
|
666 | 666 | // If $series is set but episode is not, return Season Packs and Episodes |
667 | 667 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
668 | 668 | } |
@@ -676,26 +676,26 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
679 | - if (! empty($name) && $showSql === '') { |
|
680 | - if (! empty($series) && (int) $series < 1900) { |
|
679 | + if (!empty($name) && $showSql === '') { |
|
680 | + if (!empty($series) && (int) $series < 1900) { |
|
681 | 681 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
682 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
682 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
683 | 683 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
684 | 684 | } |
685 | 685 | // If season is not empty but episode is, add a wildcard to the search |
686 | 686 | if (empty($episode)) { |
687 | 687 | $name .= '*'; |
688 | 688 | } |
689 | - } elseif (! empty($airDate)) { |
|
689 | + } elseif (!empty($airDate)) { |
|
690 | 690 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
691 | 691 | } |
692 | 692 | } |
693 | - if (! empty($name)) { |
|
693 | + if (!empty($name)) { |
|
694 | 694 | if (config('nntmux.elasticsearch_enabled') === true) { |
695 | 695 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
696 | 696 | } else { |
697 | 697 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
698 | - if (! empty($searchResult)) { |
|
698 | + if (!empty($searchResult)) { |
|
699 | 699 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
700 | 700 | } |
701 | 701 | } |
@@ -711,11 +711,11 @@ discard block |
||
711 | 711 | NZB::NZB_ADDED, |
712 | 712 | $this->showPasswords(), |
713 | 713 | $showSql, |
714 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
714 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
715 | 715 | Category::getCategorySearch($cat, true), |
716 | 716 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
717 | 717 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
718 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
718 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
719 | 719 | ); |
720 | 720 | $baseSql = sprintf( |
721 | 721 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | if ($releases !== null) { |
752 | 752 | return $releases; |
753 | 753 | } |
754 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
754 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
755 | 755 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
756 | 756 | $releases[0]->_totalrows = $this->getPagerCount( |
757 | 757 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -799,11 +799,11 @@ discard block |
||
799 | 799 | |
800 | 800 | $show = self::fromQuery($showQry); |
801 | 801 | if ($show->isNotEmpty()) { |
802 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
802 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
803 | 803 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
804 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
804 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
805 | 805 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
806 | - } elseif (! empty($series) && empty($episode)) { |
|
806 | + } elseif (!empty($series) && empty($episode)) { |
|
807 | 807 | // If $series is set but episode is not, return Season Packs and Episodes |
808 | 808 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
809 | 809 | } |
@@ -816,26 +816,26 @@ discard block |
||
816 | 816 | } |
817 | 817 | } |
818 | 818 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
819 | - if (! empty($name) && $showSql === '') { |
|
820 | - if (! empty($series) && (int) $series < 1900) { |
|
819 | + if (!empty($name) && $showSql === '') { |
|
820 | + if (!empty($series) && (int) $series < 1900) { |
|
821 | 821 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
822 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
822 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
823 | 823 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
824 | 824 | } |
825 | 825 | // If season is not empty but episode is, add a wildcard to the search |
826 | 826 | if (empty($episode)) { |
827 | 827 | $name .= '*'; |
828 | 828 | } |
829 | - } elseif (! empty($airDate)) { |
|
829 | + } elseif (!empty($airDate)) { |
|
830 | 830 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
831 | 831 | } |
832 | 832 | } |
833 | - if (! empty($name)) { |
|
833 | + if (!empty($name)) { |
|
834 | 834 | if (config('nntmux.elasticsearch_enabled') === true) { |
835 | 835 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
836 | 836 | } else { |
837 | 837 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
838 | - if (! empty($searchResult)) { |
|
838 | + if (!empty($searchResult)) { |
|
839 | 839 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
840 | 840 | } |
841 | 841 | } |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | NZB::NZB_ADDED, |
852 | 852 | $this->showPasswords(), |
853 | 853 | $showSql, |
854 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
854 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
855 | 855 | Category::getCategorySearch($cat, true), |
856 | 856 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
857 | 857 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
858 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
858 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
859 | 859 | ); |
860 | 860 | $baseSql = sprintf( |
861 | 861 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -905,12 +905,12 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
907 | 907 | { |
908 | - if (! empty($name)) { |
|
908 | + if (!empty($name)) { |
|
909 | 909 | if (config('nntmux.elasticsearch_enabled') === true) { |
910 | 910 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
911 | 911 | } else { |
912 | 912 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
913 | - if (! empty($searchResult)) { |
|
913 | + if (!empty($searchResult)) { |
|
914 | 914 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
915 | 915 | } |
916 | 916 | } |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | $this->showPasswords(), |
928 | 928 | NZB::NZB_ADDED, |
929 | 929 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
930 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
931 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
930 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
931 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
932 | 932 | Category::getCategorySearch($cat, true), |
933 | 933 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
934 | 934 | ); |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | */ |
976 | 976 | public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed |
977 | 977 | { |
978 | - if (! empty($name)) { |
|
978 | + if (!empty($name)) { |
|
979 | 979 | if (config('nntmux.elasticsearch_enabled') === true) { |
980 | 980 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
981 | 981 | } else { |
982 | 982 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
983 | - if (! empty($searchResult)) { |
|
983 | + if (!empty($searchResult)) { |
|
984 | 984 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
985 | 985 | } |
986 | 986 | } |
@@ -997,11 +997,11 @@ discard block |
||
997 | 997 | %s %s %s %s %s %s %s', |
998 | 998 | NZB::NZB_ADDED, |
999 | 999 | $this->showPasswords(), |
1000 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1000 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
1001 | 1001 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
1002 | 1002 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
1003 | 1003 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
1004 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1004 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
1005 | 1005 | Category::getCategorySearch($cat, true), |
1006 | 1006 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
1007 | 1007 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1060 | - if (! $results) { |
|
1060 | + if (!$results) { |
|
1061 | 1061 | return $ret; |
1062 | 1062 | } |
1063 | 1063 |
@@ -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; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | ->where('movieinfo.title', '!=', '') |
187 | 187 | ->where('movieinfo.imdbid', '!=', '0000000') |
188 | 188 | ->when($maxAge > 0, fn ($query) => $query->whereRaw('r.postdate > NOW() - INTERVAL ? DAY', [$maxAge])) |
189 | - ->when(! empty($excludedCats), fn ($query) => $query->whereNotIn('r.categories_id', $excludedCats)) |
|
190 | - ->when(! empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch)) |
|
189 | + ->when(!empty($excludedCats), fn ($query) => $query->whereNotIn('r.categories_id', $excludedCats)) |
|
190 | + ->when(!empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch)) |
|
191 | 191 | ->groupBy('movieinfo.imdbid') |
192 | 192 | ->orderBy($order[0], $order[1]) |
193 | 193 | ->offset($start) |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $movieIDs = $movies->pluck('imdbid')->toArray(); |
200 | 200 | $releaseIDs = $movies->pluck('grp_release_id')->toArray(); |
201 | 201 | |
202 | - if (! empty($movieIDs)) { |
|
202 | + if (!empty($movieIDs)) { |
|
203 | 203 | $moviesDetailQuery = Release::query() |
204 | 204 | ->selectRaw(' |
205 | 205 | GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ",") AS grp_release_id, |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | ->join('movieinfo as m', 'm.imdbid', '=', 'r.imdbid') |
230 | 230 | ->whereIn('m.imdbid', $movieIDs) |
231 | 231 | ->whereIn('r.id', $releaseIDs) |
232 | - ->when(! empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch)) |
|
232 | + ->when(!empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch)) |
|
233 | 233 | ->groupBy('m.imdbid') |
234 | 234 | ->orderBy($order[0], $order[1]) |
235 | 235 | ->get(); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $browseBy = ' '; |
287 | 287 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
288 | 288 | foreach ($browseByArr as $bb) { |
289 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
289 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
290 | 290 | $bbv = stripslashes(request()->input($bb)); |
291 | 291 | if ($bb === 'rating') { |
292 | 292 | $bbv .= '.'; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | if ($this->traktcheck !== null) { |
321 | 321 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
322 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
322 | + if (($data !== false) && !empty($data['trailer'])) { |
|
323 | 323 | return $data['trailer']; |
324 | 324 | } |
325 | 325 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | |
348 | - if (! empty($data['trailer'])) { |
|
348 | + if (!empty($data['trailer'])) { |
|
349 | 349 | $data['trailer'] = str_ireplace( |
350 | 350 | ['watch?v=', 'http://'], |
351 | 351 | ['embed/', 'https://'], |
@@ -379,17 +379,17 @@ discard block |
||
379 | 379 | */ |
380 | 380 | private function checkTraktValue($value) |
381 | 381 | { |
382 | - if (\is_array($value) && ! empty($value)) { |
|
382 | + if (\is_array($value) && !empty($value)) { |
|
383 | 383 | $temp = ''; |
384 | 384 | foreach ($value as $val) { |
385 | - if (! \is_array($val) && ! \is_object($val)) { |
|
385 | + if (!\is_array($val) && !\is_object($val)) { |
|
386 | 386 | $temp .= $val; |
387 | 387 | } |
388 | 388 | } |
389 | 389 | $value = $temp; |
390 | 390 | } |
391 | 391 | |
392 | - return ! empty($value) ? $value : ''; |
|
392 | + return !empty($value) ? $value : ''; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function update(array $values): bool |
412 | 412 | { |
413 | - if (! \count($values)) { |
|
413 | + if (!\count($values)) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $onDuplicateKey = ['created_at' => now()]; |
419 | 419 | $found = 0; |
420 | 420 | foreach ($values as $key => $value) { |
421 | - if (! empty($value)) { |
|
421 | + if (!empty($value)) { |
|
422 | 422 | $found++; |
423 | 423 | if (\in_array($key, ['genre', 'language'], false)) { |
424 | 424 | $value = substr($value, 0, 64); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $onDuplicateKey += [$key => $value]; |
428 | 428 | } |
429 | 429 | } |
430 | - if (! $found) { |
|
430 | + if (!$found) { |
|
431 | 431 | return false; |
432 | 432 | } |
433 | 433 | foreach ($query as $key => $value) { |
@@ -444,19 +444,19 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
446 | 446 | { |
447 | - if (! empty($variable1)) { |
|
447 | + if (!empty($variable1)) { |
|
448 | 448 | return $variable1; |
449 | 449 | } |
450 | - if (! empty($variable2)) { |
|
450 | + if (!empty($variable2)) { |
|
451 | 451 | return $variable2; |
452 | 452 | } |
453 | - if (! empty($variable3)) { |
|
453 | + if (!empty($variable3)) { |
|
454 | 454 | return $variable3; |
455 | 455 | } |
456 | - if (! empty($variable4)) { |
|
456 | + if (!empty($variable4)) { |
|
457 | 457 | return $variable4; |
458 | 458 | } |
459 | - if (! empty($variable5)) { |
|
459 | + if (!empty($variable5)) { |
|
460 | 460 | return $variable5; |
461 | 461 | } |
462 | 462 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | |
492 | 492 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
493 | 493 | |
494 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
494 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
495 | 495 | return false; |
496 | 496 | } |
497 | 497 | |
@@ -504,36 +504,36 @@ discard block |
||
504 | 504 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
505 | 505 | |
506 | 506 | $mov['imdbid'] = $imdbId; |
507 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
508 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
507 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
508 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
509 | 509 | |
510 | 510 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
511 | - if (! empty($fanart['cover'])) { |
|
511 | + if (!empty($fanart['cover'])) { |
|
512 | 512 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
513 | - } elseif (! empty($tmdb['cover'])) { |
|
513 | + } elseif (!empty($tmdb['cover'])) { |
|
514 | 514 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
515 | - } elseif (! empty($imdb['cover'])) { |
|
515 | + } elseif (!empty($imdb['cover'])) { |
|
516 | 516 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
517 | - } elseif (! empty($omdb['cover'])) { |
|
517 | + } elseif (!empty($omdb['cover'])) { |
|
518 | 518 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
519 | - } elseif (! empty($iTunes['cover'])) { |
|
519 | + } elseif (!empty($iTunes['cover'])) { |
|
520 | 520 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
521 | 521 | } |
522 | 522 | |
523 | 523 | // Backdrops. |
524 | - if (! empty($fanart['backdrop'])) { |
|
524 | + if (!empty($fanart['backdrop'])) { |
|
525 | 525 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
526 | - } elseif (! empty($tmdb['backdrop'])) { |
|
526 | + } elseif (!empty($tmdb['backdrop'])) { |
|
527 | 527 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
528 | 528 | } |
529 | 529 | |
530 | 530 | // Banner |
531 | - if (! empty($fanart['banner'])) { |
|
531 | + if (!empty($fanart['banner'])) { |
|
532 | 532 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
533 | 533 | } |
534 | 534 | |
535 | 535 | // RottenTomatoes rating from OmdbAPI |
536 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
536 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
537 | 537 | $mov['rtrating'] = $omdb['rtRating']; |
538 | 538 | } |
539 | 539 | |
@@ -544,29 +544,29 @@ discard block |
||
544 | 544 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
545 | 545 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
546 | 546 | |
547 | - if (! empty($imdb['type'])) { |
|
547 | + if (!empty($imdb['type'])) { |
|
548 | 548 | $mov['type'] = $imdb['type']; |
549 | 549 | } |
550 | 550 | |
551 | - if (! empty($imdb['director'])) { |
|
551 | + if (!empty($imdb['director'])) { |
|
552 | 552 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
553 | - } elseif (! empty($omdb['director'])) { |
|
553 | + } elseif (!empty($omdb['director'])) { |
|
554 | 554 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
555 | - } elseif (! empty($tmdb['director'])) { |
|
555 | + } elseif (!empty($tmdb['director'])) { |
|
556 | 556 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
557 | 557 | } |
558 | 558 | |
559 | - if (! empty($imdb['actors'])) { |
|
559 | + if (!empty($imdb['actors'])) { |
|
560 | 560 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
561 | - } elseif (! empty($omdb['actors'])) { |
|
561 | + } elseif (!empty($omdb['actors'])) { |
|
562 | 562 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
563 | - } elseif (! empty($tmdb['actors'])) { |
|
563 | + } elseif (!empty($tmdb['actors'])) { |
|
564 | 564 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
565 | 565 | } |
566 | 566 | |
567 | - if (! empty($imdb['language'])) { |
|
567 | + if (!empty($imdb['language'])) { |
|
568 | 568 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
569 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
569 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
570 | 570 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
571 | 571 | } |
572 | 572 | |
@@ -624,20 +624,20 @@ discard block |
||
624 | 624 | if ($this->fanartapikey !== null) { |
625 | 625 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
626 | 626 | |
627 | - if (! empty($art)) { |
|
627 | + if (!empty($art)) { |
|
628 | 628 | if (isset($art['status']) && $art['status'] === 'error') { |
629 | 629 | return false; |
630 | 630 | } |
631 | 631 | $ret = []; |
632 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
632 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
633 | 633 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
634 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
634 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
635 | 635 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
636 | 636 | } |
637 | - if (! empty($art['movieposter'][0]['url'])) { |
|
637 | + if (!empty($art['movieposter'][0]['url'])) { |
|
638 | 638 | $ret['cover'] = $art['movieposter'][0]['url']; |
639 | 639 | } |
640 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
640 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
641 | 641 | $ret['banner'] = $art['moviebanner'][0]['url']; |
642 | 642 | } |
643 | 643 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | return false; |
675 | 675 | } |
676 | 676 | |
677 | - if (! empty($tmdbLookup)) { |
|
677 | + if (!empty($tmdbLookup)) { |
|
678 | 678 | if ($this->currentTitle !== '') { |
679 | 679 | // Check the similarity. |
680 | 680 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $ret['rating'] = ''; |
704 | 704 | } |
705 | 705 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
706 | - if (! empty($actors)) { |
|
706 | + if (!empty($actors)) { |
|
707 | 707 | $ret['actors'] = $actors; |
708 | 708 | } else { |
709 | 709 | $ret['actors'] = ''; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | } |
715 | 715 | } |
716 | 716 | $overview = $tmdbLookup['overview']; |
717 | - if (! empty($overview)) { |
|
717 | + if (!empty($overview)) { |
|
718 | 718 | $ret['plot'] = $overview; |
719 | 719 | } else { |
720 | 720 | $ret['plot'] = ''; |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | $ret['tagline'] = $tagline ?? ''; |
725 | 725 | |
726 | 726 | $released = $tmdbLookup['release_date']; |
727 | - if (! empty($released)) { |
|
727 | + if (!empty($released)) { |
|
728 | 728 | $ret['year'] = Carbon::parse($released)->year; |
729 | 729 | } else { |
730 | 730 | $ret['year'] = ''; |
731 | 731 | } |
732 | 732 | $genresa = $tmdbLookup['genres']; |
733 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
733 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
734 | 734 | $genres = []; |
735 | 735 | foreach ($genresa as $genre) { |
736 | 736 | $genres[] = $genre['name']; |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | $ret['genre'] = ''; |
741 | 741 | } |
742 | 742 | $posterp = $tmdbLookup['poster_path']; |
743 | - if (! empty($posterp)) { |
|
743 | + if (!empty($posterp)) { |
|
744 | 744 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
745 | 745 | } else { |
746 | 746 | $ret['cover'] = ''; |
747 | 747 | } |
748 | 748 | $backdrop = $tmdbLookup['backdrop_path']; |
749 | - if (! empty($backdrop)) { |
|
749 | + if (!empty($backdrop)) { |
|
750 | 750 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
751 | 751 | } else { |
752 | 752 | $ret['backdrop'] = ''; |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | { |
769 | 769 | $realId = (new Title($imdbId, $this->config))->real_id(); |
770 | 770 | $result = new Title($realId, $this->config); |
771 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
772 | - if (! empty($title)) { |
|
773 | - if (! empty($this->currentTitle)) { |
|
771 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
772 | + if (!empty($title)) { |
|
773 | + if (!empty($this->currentTitle)) { |
|
774 | 774 | similar_text($this->currentTitle, $title, $percent); |
775 | 775 | if ($percent >= self::MATCH_PERCENT) { |
776 | 776 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | 'title' => $title, |
780 | 780 | 'tagline' => $result->tagline() ?? '', |
781 | 781 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
782 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
782 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
783 | 783 | 'year' => $result->year() ?? '', |
784 | 784 | 'cover' => $result->photo() ?? '', |
785 | 785 | 'genre' => $result->genre() ?? '', |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | 'title' => $title, |
805 | 805 | 'tagline' => $result->tagline() ?? '', |
806 | 806 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
807 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
807 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
808 | 808 | 'year' => $result->year() ?? '', |
809 | 809 | 'cover' => $result->photo() ?? '', |
810 | 810 | 'genre' => $result->genre() ?? '', |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | if ($this->omdbapikey !== null) { |
879 | 879 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
880 | 880 | |
881 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
881 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
882 | 882 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
883 | 883 | if ($percent >= self::MATCH_PERCENT) { |
884 | 884 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | // Loop over releases. |
1045 | 1045 | foreach ($res as $arr) { |
1046 | 1046 | // Try to get a name/year. |
1047 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
1047 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
1048 | 1048 | //We didn't find a name, so set to all 0's so we don't parse again. |
1049 | 1049 | Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); |
1050 | 1050 | |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | try { |
1079 | 1079 | $imdbSearch = new TitleSearch($this->config); |
1080 | 1080 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
1081 | - if (! empty($imdbTitle->title())) { |
|
1081 | + if (!empty($imdbTitle->title())) { |
|
1082 | 1082 | similar_text($imdbTitle->title(), $this->currentTitle, $percent); |
1083 | 1083 | if ($percent >= self::MATCH_PERCENT) { |
1084 | 1084 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1108,10 +1108,10 @@ discard block |
||
1108 | 1108 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1111 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1112 | 1112 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
1113 | 1113 | |
1114 | - if (! empty($getIMDBid)) { |
|
1114 | + if (!empty($getIMDBid)) { |
|
1115 | 1115 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
1116 | 1116 | if ($imdbId !== false) { |
1117 | 1117 | $movieUpdated = true; |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
1127 | 1127 | if ($data !== false) { |
1128 | 1128 | $this->parseTraktTv($data); |
1129 | - if (! empty($data['ids']['imdb'])) { |
|
1129 | + if (!empty($data['ids']['imdb'])) { |
|
1130 | 1130 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
1131 | 1131 | if ($imdbId !== false) { |
1132 | 1132 | $movieUpdated = true; |
@@ -1139,13 +1139,13 @@ discard block |
||
1139 | 1139 | if ($movieUpdated === false) { |
1140 | 1140 | try { |
1141 | 1141 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
1142 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
1142 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
1143 | 1143 | foreach ($data['results'] as $result) { |
1144 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
1144 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
1145 | 1145 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
1146 | 1146 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
1147 | 1147 | $ret = $this->fetchTMDBProperties($result['id'], true); |
1148 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
1148 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
1149 | 1149 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
1150 | 1150 | if ($imdbId !== false) { |
1151 | 1151 | $movieUpdated = true; |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | // Finally remove multiple spaces and trim leading spaces. |
1247 | 1247 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
1248 | 1248 | // Check if the name is long enough and not just numbers. |
1249 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
1249 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
1250 | 1250 | $this->currentTitle = $name; |
1251 | 1251 | $this->currentYear = $year; |
1252 | 1252 |