@@ -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; |
@@ -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; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ORDER BY %s %s %s", |
194 | 194 | $this->showPasswords, |
195 | 195 | $this->getBrowseBy(), |
196 | - (! empty($catsrch) ? $catsrch : ''), |
|
196 | + (!empty($catsrch) ? $catsrch : ''), |
|
197 | 197 | ( |
198 | 198 | $maxAge > 0 |
199 | 199 | ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | Cache::put(md5($moviesSql.$page), $movies, $expiresAt); |
214 | 214 | } |
215 | 215 | $movieIDs = $releaseIDs = []; |
216 | - if (! empty($movies['result'])) { |
|
216 | + if (!empty($movies['result'])) { |
|
217 | 217 | foreach ($movies['result'] as $movie => $id) { |
218 | 218 | $movieIDs[] = $id->imdbid; |
219 | 219 | $releaseIDs[] = $id->grp_release_id; |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | AND r.id IN (%s) %s |
253 | 253 | GROUP BY m.imdbid |
254 | 254 | ORDER BY %s %s", |
255 | - (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
256 | - (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
257 | - (! empty($catsrch) ? $catsrch : ''), |
|
255 | + (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
256 | + (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
257 | + (!empty($catsrch) ? $catsrch : ''), |
|
258 | 258 | $order[0], |
259 | 259 | $order[1] |
260 | 260 | ); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $browseBy = ' '; |
301 | 301 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
302 | 302 | foreach ($browseByArr as $bb) { |
303 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
303 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
304 | 304 | $bbv = stripslashes(request()->input($bb)); |
305 | 305 | if ($bb === 'rating') { |
306 | 306 | $bbv .= '.'; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | if ($this->traktcheck !== null) { |
335 | 335 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
336 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
336 | + if (($data !== false) && !empty($data['trailer'])) { |
|
337 | 337 | return $data['trailer']; |
338 | 338 | } |
339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | return false; |
360 | 360 | } |
361 | 361 | |
362 | - if (! empty($data['trailer'])) { |
|
362 | + if (!empty($data['trailer'])) { |
|
363 | 363 | $data['trailer'] = str_ireplace( |
364 | 364 | ['watch?v=', 'http://'], |
365 | 365 | ['embed/', 'https://'], |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | */ |
394 | 394 | private function checkTraktValue($value) |
395 | 395 | { |
396 | - if (\is_array($value) && ! empty($value)) { |
|
396 | + if (\is_array($value) && !empty($value)) { |
|
397 | 397 | $temp = ''; |
398 | 398 | foreach ($value as $val) { |
399 | - if (! \is_array($val) && ! \is_object($val)) { |
|
399 | + if (!\is_array($val) && !\is_object($val)) { |
|
400 | 400 | $temp .= $val; |
401 | 401 | } |
402 | 402 | } |
403 | 403 | $value = $temp; |
404 | 404 | } |
405 | 405 | |
406 | - return ! empty($value) ? $value : ''; |
|
406 | + return !empty($value) ? $value : ''; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function update(array $values): bool |
426 | 426 | { |
427 | - if (! \count($values)) { |
|
427 | + if (!\count($values)) { |
|
428 | 428 | return false; |
429 | 429 | } |
430 | 430 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $onDuplicateKey = ['created_at' => now()]; |
433 | 433 | $found = 0; |
434 | 434 | foreach ($values as $key => $value) { |
435 | - if (! empty($value)) { |
|
435 | + if (!empty($value)) { |
|
436 | 436 | $found++; |
437 | 437 | if (\in_array($key, ['genre', 'language'], false)) { |
438 | 438 | $value = substr($value, 0, 64); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $onDuplicateKey += [$key => $value]; |
442 | 442 | } |
443 | 443 | } |
444 | - if (! $found) { |
|
444 | + if (!$found) { |
|
445 | 445 | return false; |
446 | 446 | } |
447 | 447 | foreach ($query as $key => $value) { |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | */ |
459 | 459 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
460 | 460 | { |
461 | - if (! empty($variable1)) { |
|
461 | + if (!empty($variable1)) { |
|
462 | 462 | return $variable1; |
463 | 463 | } |
464 | - if (! empty($variable2)) { |
|
464 | + if (!empty($variable2)) { |
|
465 | 465 | return $variable2; |
466 | 466 | } |
467 | - if (! empty($variable3)) { |
|
467 | + if (!empty($variable3)) { |
|
468 | 468 | return $variable3; |
469 | 469 | } |
470 | - if (! empty($variable4)) { |
|
470 | + if (!empty($variable4)) { |
|
471 | 471 | return $variable4; |
472 | 472 | } |
473 | - if (! empty($variable5)) { |
|
473 | + if (!empty($variable5)) { |
|
474 | 474 | return $variable5; |
475 | 475 | } |
476 | 476 | |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
507 | 507 | |
508 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
508 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
509 | 509 | return false; |
510 | 510 | } |
511 | 511 | |
@@ -518,36 +518,36 @@ discard block |
||
518 | 518 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
519 | 519 | |
520 | 520 | $mov['imdbid'] = $imdbId; |
521 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
522 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
521 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
522 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
523 | 523 | |
524 | 524 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
525 | - if (! empty($fanart['cover'])) { |
|
525 | + if (!empty($fanart['cover'])) { |
|
526 | 526 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
527 | - } elseif (! empty($tmdb['cover'])) { |
|
527 | + } elseif (!empty($tmdb['cover'])) { |
|
528 | 528 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
529 | - } elseif (! empty($imdb['cover'])) { |
|
529 | + } elseif (!empty($imdb['cover'])) { |
|
530 | 530 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
531 | - } elseif (! empty($omdb['cover'])) { |
|
531 | + } elseif (!empty($omdb['cover'])) { |
|
532 | 532 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
533 | - } elseif (! empty($iTunes['cover'])) { |
|
533 | + } elseif (!empty($iTunes['cover'])) { |
|
534 | 534 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
535 | 535 | } |
536 | 536 | |
537 | 537 | // Backdrops. |
538 | - if (! empty($fanart['backdrop'])) { |
|
538 | + if (!empty($fanart['backdrop'])) { |
|
539 | 539 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
540 | - } elseif (! empty($tmdb['backdrop'])) { |
|
540 | + } elseif (!empty($tmdb['backdrop'])) { |
|
541 | 541 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
542 | 542 | } |
543 | 543 | |
544 | 544 | // Banner |
545 | - if (! empty($fanart['banner'])) { |
|
545 | + if (!empty($fanart['banner'])) { |
|
546 | 546 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
547 | 547 | } |
548 | 548 | |
549 | 549 | // RottenTomatoes rating from OmdbAPI |
550 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
550 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
551 | 551 | $mov['rtrating'] = $omdb['rtRating']; |
552 | 552 | } |
553 | 553 | |
@@ -558,29 +558,29 @@ discard block |
||
558 | 558 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
559 | 559 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
560 | 560 | |
561 | - if (! empty($imdb['type'])) { |
|
561 | + if (!empty($imdb['type'])) { |
|
562 | 562 | $mov['type'] = $imdb['type']; |
563 | 563 | } |
564 | 564 | |
565 | - if (! empty($imdb['director'])) { |
|
565 | + if (!empty($imdb['director'])) { |
|
566 | 566 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
567 | - } elseif (! empty($omdb['director'])) { |
|
567 | + } elseif (!empty($omdb['director'])) { |
|
568 | 568 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
569 | - } elseif (! empty($tmdb['director'])) { |
|
569 | + } elseif (!empty($tmdb['director'])) { |
|
570 | 570 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
571 | 571 | } |
572 | 572 | |
573 | - if (! empty($imdb['actors'])) { |
|
573 | + if (!empty($imdb['actors'])) { |
|
574 | 574 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
575 | - } elseif (! empty($omdb['actors'])) { |
|
575 | + } elseif (!empty($omdb['actors'])) { |
|
576 | 576 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
577 | - } elseif (! empty($tmdb['actors'])) { |
|
577 | + } elseif (!empty($tmdb['actors'])) { |
|
578 | 578 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
579 | 579 | } |
580 | 580 | |
581 | - if (! empty($imdb['language'])) { |
|
581 | + if (!empty($imdb['language'])) { |
|
582 | 582 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
583 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
583 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
584 | 584 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
585 | 585 | } |
586 | 586 | |
@@ -638,20 +638,20 @@ discard block |
||
638 | 638 | if ($this->fanartapikey !== null) { |
639 | 639 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
640 | 640 | |
641 | - if (! empty($art)) { |
|
641 | + if (!empty($art)) { |
|
642 | 642 | if (isset($art['status']) && $art['status'] === 'error') { |
643 | 643 | return false; |
644 | 644 | } |
645 | 645 | $ret = []; |
646 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
646 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
647 | 647 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
648 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
648 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
649 | 649 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
650 | 650 | } |
651 | - if (! empty($art['movieposter'][0]['url'])) { |
|
651 | + if (!empty($art['movieposter'][0]['url'])) { |
|
652 | 652 | $ret['cover'] = $art['movieposter'][0]['url']; |
653 | 653 | } |
654 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
654 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
655 | 655 | $ret['banner'] = $art['moviebanner'][0]['url']; |
656 | 656 | } |
657 | 657 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | return false; |
689 | 689 | } |
690 | 690 | |
691 | - if (! empty($tmdbLookup)) { |
|
691 | + if (!empty($tmdbLookup)) { |
|
692 | 692 | if ($this->currentTitle !== '') { |
693 | 693 | // Check the similarity. |
694 | 694 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $ret['rating'] = ''; |
718 | 718 | } |
719 | 719 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
720 | - if (! empty($actors)) { |
|
720 | + if (!empty($actors)) { |
|
721 | 721 | $ret['actors'] = $actors; |
722 | 722 | } else { |
723 | 723 | $ret['actors'] = ''; |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | } |
729 | 729 | } |
730 | 730 | $overview = $tmdbLookup['overview']; |
731 | - if (! empty($overview)) { |
|
731 | + if (!empty($overview)) { |
|
732 | 732 | $ret['plot'] = $overview; |
733 | 733 | } else { |
734 | 734 | $ret['plot'] = ''; |
@@ -738,13 +738,13 @@ discard block |
||
738 | 738 | $ret['tagline'] = $tagline ?? ''; |
739 | 739 | |
740 | 740 | $released = $tmdbLookup['release_date']; |
741 | - if (! empty($released)) { |
|
741 | + if (!empty($released)) { |
|
742 | 742 | $ret['year'] = Carbon::parse($released)->year; |
743 | 743 | } else { |
744 | 744 | $ret['year'] = ''; |
745 | 745 | } |
746 | 746 | $genresa = $tmdbLookup['genres']; |
747 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
747 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
748 | 748 | $genres = []; |
749 | 749 | foreach ($genresa as $genre) { |
750 | 750 | $genres[] = $genre['name']; |
@@ -754,13 +754,13 @@ discard block |
||
754 | 754 | $ret['genre'] = ''; |
755 | 755 | } |
756 | 756 | $posterp = $tmdbLookup['poster_path']; |
757 | - if (! empty($posterp)) { |
|
757 | + if (!empty($posterp)) { |
|
758 | 758 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
759 | 759 | } else { |
760 | 760 | $ret['cover'] = ''; |
761 | 761 | } |
762 | 762 | $backdrop = $tmdbLookup['backdrop_path']; |
763 | - if (! empty($backdrop)) { |
|
763 | + if (!empty($backdrop)) { |
|
764 | 764 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
765 | 765 | } else { |
766 | 766 | $ret['backdrop'] = ''; |
@@ -782,9 +782,9 @@ discard block |
||
782 | 782 | { |
783 | 783 | $realId = (new Title($imdbId, $this->config))->real_id(); |
784 | 784 | $result = new Title($realId, $this->config); |
785 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
786 | - if (! empty($title)) { |
|
787 | - if (! empty($this->currentTitle)) { |
|
785 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
786 | + if (!empty($title)) { |
|
787 | + if (!empty($this->currentTitle)) { |
|
788 | 788 | similar_text($this->currentTitle, $title, $percent); |
789 | 789 | if ($percent >= self::MATCH_PERCENT) { |
790 | 790 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | 'title' => $title, |
794 | 794 | 'tagline' => $result->tagline() ?? '', |
795 | 795 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
796 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
796 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
797 | 797 | 'year' => $result->year() ?? '', |
798 | 798 | 'cover' => $result->photo() ?? '', |
799 | 799 | 'genre' => $result->genre() ?? '', |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | 'title' => $title, |
819 | 819 | 'tagline' => $result->tagline() ?? '', |
820 | 820 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
821 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
821 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
822 | 822 | 'year' => $result->year() ?? '', |
823 | 823 | 'cover' => $result->photo() ?? '', |
824 | 824 | 'genre' => $result->genre() ?? '', |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | if ($this->omdbapikey !== null) { |
893 | 893 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
894 | 894 | |
895 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
895 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
896 | 896 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
897 | 897 | if ($percent >= self::MATCH_PERCENT) { |
898 | 898 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | // Loop over releases. |
1059 | 1059 | foreach ($res as $arr) { |
1060 | 1060 | // Try to get a name/year. |
1061 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
1061 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
1062 | 1062 | // We didn't find a name, so set to all 0's so we don't parse again. |
1063 | 1063 | Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); |
1064 | 1064 | |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | try { |
1093 | 1093 | $imdbSearch = new TitleSearch($this->config); |
1094 | 1094 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
1095 | - if (! empty($imdbTitle->title())) { |
|
1095 | + if (!empty($imdbTitle->title())) { |
|
1096 | 1096 | similar_text($imdbTitle->title(), $this->currentTitle, $percent); |
1097 | 1097 | if ($percent >= self::MATCH_PERCENT) { |
1098 | 1098 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1122,10 +1122,10 @@ discard block |
||
1122 | 1122 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1125 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1126 | 1126 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
1127 | 1127 | |
1128 | - if (! empty($getIMDBid)) { |
|
1128 | + if (!empty($getIMDBid)) { |
|
1129 | 1129 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
1130 | 1130 | if ($imdbId !== false) { |
1131 | 1131 | $movieUpdated = true; |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
1141 | 1141 | if ($data !== false) { |
1142 | 1142 | $this->parseTraktTv($data); |
1143 | - if (! empty($data['ids']['imdb'])) { |
|
1143 | + if (!empty($data['ids']['imdb'])) { |
|
1144 | 1144 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
1145 | 1145 | if ($imdbId !== false) { |
1146 | 1146 | $movieUpdated = true; |
@@ -1153,13 +1153,13 @@ discard block |
||
1153 | 1153 | if ($movieUpdated === false) { |
1154 | 1154 | try { |
1155 | 1155 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
1156 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
1156 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
1157 | 1157 | foreach ($data['results'] as $result) { |
1158 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
1158 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
1159 | 1159 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
1160 | 1160 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
1161 | 1161 | $ret = $this->fetchTMDBProperties($result['id'], true); |
1162 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
1162 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
1163 | 1163 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
1164 | 1164 | if ($imdbId !== false) { |
1165 | 1165 | $movieUpdated = true; |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | // Finally remove multiple spaces and trim leading spaces. |
1261 | 1261 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
1262 | 1262 | // Check if the name is long enough and not just numbers. |
1263 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
1263 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
1264 | 1264 | $this->currentTitle = $name; |
1265 | 1265 | $this->currentYear = $year; |
1266 | 1266 |
@@ -277,8 +277,8 @@ |
||
277 | 277 | |
278 | 278 | // Execute a Scroll request and repeat |
279 | 279 | $results = Elasticsearch::scroll([ |
280 | - 'scroll_id' => $scroll_id, // ...using our previously obtained _scroll_id |
|
281 | - 'scroll' => '30s', // and the same timeout window |
|
280 | + 'scroll_id' => $scroll_id, // ...using our previously obtained _scroll_id |
|
281 | + 'scroll' => '30s', // and the same timeout window |
|
282 | 282 | ] |
283 | 283 | ); |
284 | 284 | } |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | $this->processWork(); |
267 | 267 | $maxWork = \count($this->work); |
268 | 268 | foreach ($this->work as $group) { |
269 | - $pool->add(function () use ($group) { |
|
269 | + $pool->add(function() use ($group) { |
|
270 | 270 | return $this->_executeCommand(PHP_BINARY.' misc/update/backfill.php '.$group->name.(isset($group->max) ? (' '.$group->max) : '')); |
271 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
271 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
272 | 272 | echo $output; |
273 | 273 | $this->colorCli->primary('Task #'.$maxWork.' Backfilled group '.$group->name); |
274 | - })->catch(function (\Throwable $exception) { |
|
274 | + })->catch(function(\Throwable $exception) { |
|
275 | 275 | echo $exception->getMessage(); |
276 | - })->catch(static function (SerializableException $serializableException) { |
|
276 | + })->catch(static function(SerializableException $serializableException) { |
|
277 | 277 | // we do nothing here just catch the error and move on |
278 | 278 | }); |
279 | 279 | $maxWork--; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | ); |
340 | 340 | |
341 | 341 | $count = 0; |
342 | - if (! empty($data) && isset($data[0]->name)) { |
|
342 | + if (!empty($data) && isset($data[0]->name)) { |
|
343 | 343 | $this->safeBackfillGroup = $data[0]->name; |
344 | 344 | |
345 | 345 | $count = ($data[0]->our_first - $data[0]->their_first); |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | |
362 | 362 | $this->processWork(); |
363 | 363 | foreach ($queues as $queue) { |
364 | - $pool->add(function () use ($queue) { |
|
364 | + $pool->add(function() use ($queue) { |
|
365 | 365 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
366 | - }, 2000000)->then(function ($output) { |
|
366 | + }, 2000000)->then(function($output) { |
|
367 | 367 | echo $output; |
368 | 368 | $this->colorCli->primary('Backfilled group '.$this->safeBackfillGroup); |
369 | - })->catch(function (\Throwable $exception) { |
|
369 | + })->catch(function(\Throwable $exception) { |
|
370 | 370 | echo $exception->getMessage(); |
371 | - })->catch(static function (SerializableException $serializableException) { |
|
371 | + })->catch(static function(SerializableException $serializableException) { |
|
372 | 372 | // we do nothing here just catch the error and move on |
373 | 373 | }); |
374 | 374 | } |
@@ -401,14 +401,14 @@ discard block |
||
401 | 401 | |
402 | 402 | $this->processWork(); |
403 | 403 | foreach ($this->work as $group) { |
404 | - $pool->add(function () use ($group) { |
|
404 | + $pool->add(function() use ($group) { |
|
405 | 405 | return $this->_executeCommand(PHP_BINARY.' misc/update/update_binaries.php '.$group->name.' '.$group->max); |
406 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
406 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
407 | 407 | echo $output; |
408 | 408 | $this->colorCli->primary('Task #'.$maxWork.' Updated group '.$group->name); |
409 | - })->catch(function (\Throwable $exception) { |
|
409 | + })->catch(function(\Throwable $exception) { |
|
410 | 410 | echo $exception->getMessage(); |
411 | - })->catch(static function (SerializableException $serializableException) { |
|
411 | + })->catch(static function(SerializableException $serializableException) { |
|
412 | 412 | // we do nothing here just catch the error and move on |
413 | 413 | }); |
414 | 414 | $maxWork--; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | ORDER BY a.last_record DESC' |
436 | 436 | ); |
437 | 437 | |
438 | - if (! empty($this->work)) { |
|
438 | + if (!empty($this->work)) { |
|
439 | 439 | $i = 1; |
440 | 440 | $queues = []; |
441 | 441 | foreach ($this->work as $group) { |
@@ -468,16 +468,16 @@ discard block |
||
468 | 468 | $this->processWork(); |
469 | 469 | foreach ($queues as $queue) { |
470 | 470 | preg_match('/alt\..+/i', $queue, $hit); |
471 | - $pool->add(function () use ($queue) { |
|
471 | + $pool->add(function() use ($queue) { |
|
472 | 472 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
473 | - }, 2000000)->then(function ($output) use ($hit) { |
|
474 | - if (! empty($hit)) { |
|
473 | + }, 2000000)->then(function($output) use ($hit) { |
|
474 | + if (!empty($hit)) { |
|
475 | 475 | echo $output; |
476 | 476 | $this->colorCli->primary('Updated group '.$hit[0]); |
477 | 477 | } |
478 | - })->catch(function (\Throwable $exception) { |
|
478 | + })->catch(function(\Throwable $exception) { |
|
479 | 479 | echo $exception->getMessage(); |
480 | - })->catch(static function (SerializableException $serializableException) { |
|
480 | + })->catch(static function(SerializableException $serializableException) { |
|
481 | 481 | // we do nothing here just catch the error and move on |
482 | 482 | }); |
483 | 483 | } |
@@ -540,14 +540,14 @@ discard block |
||
540 | 540 | |
541 | 541 | $this->processWork(); |
542 | 542 | foreach ($this->work as $queue) { |
543 | - $pool->add(function () use ($queue) { |
|
543 | + $pool->add(function() use ($queue) { |
|
544 | 544 | return $this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/groupfixrelnames.php "'.$queue.'"'.' true'); |
545 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
545 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
546 | 546 | echo $output; |
547 | 547 | $this->colorCli->primary('Task #'.$maxWork.' Finished fixing releases names'); |
548 | - })->catch(function (\Throwable $exception) { |
|
548 | + })->catch(function(\Throwable $exception) { |
|
549 | 549 | echo $exception->getMessage(); |
550 | - })->catch(static function (SerializableException $serializableException) { |
|
550 | + })->catch(static function(SerializableException $serializableException) { |
|
551 | 551 | // we do nothing here just catch the error and move on |
552 | 552 | }); |
553 | 553 | $maxWork--; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | foreach ($work as $group) { |
569 | 569 | try { |
570 | 570 | $query = DB::select(sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id)); |
571 | - if (! empty($query)) { |
|
571 | + if (!empty($query)) { |
|
572 | 572 | $uGroups[] = ['id' => $group->id, 'name' => $group->name]; |
573 | 573 | } |
574 | 574 | } catch (\PDOException $e) { |
@@ -586,14 +586,14 @@ discard block |
||
586 | 586 | |
587 | 587 | $this->processWork(); |
588 | 588 | foreach ($uGroups as $group) { |
589 | - $pool->add(function () use ($group) { |
|
589 | + $pool->add(function() use ($group) { |
|
590 | 590 | return $this->_executeCommand($this->dnr_path.'releases '.$group['id'].'"'); |
591 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
591 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
592 | 592 | echo $output; |
593 | 593 | $this->colorCli->primary('Task #'.$maxWork.' Finished performing release processing'); |
594 | - })->catch(function (\Throwable $exception) { |
|
594 | + })->catch(function(\Throwable $exception) { |
|
595 | 595 | echo $exception->getMessage(); |
596 | - })->catch(static function (SerializableException $serializableException) { |
|
596 | + })->catch(static function(SerializableException $serializableException) { |
|
597 | 597 | // we do nothing here just catch the error and move on |
598 | 598 | }); |
599 | 599 | $maxWork--; |
@@ -630,16 +630,16 @@ discard block |
||
630 | 630 | $this->processWork(); |
631 | 631 | foreach ($releases as $release) { |
632 | 632 | if ($type !== '') { |
633 | - $pool->add(function () use ($release, $type) { |
|
633 | + $pool->add(function() use ($release, $type) { |
|
634 | 634 | return $this->_executeCommand(PHP_BINARY.' misc/update/postprocess.php '.$type.$release->id); |
635 | - }, 2000000)->then(function ($output) use ($desc, $count) { |
|
635 | + }, 2000000)->then(function($output) use ($desc, $count) { |
|
636 | 636 | echo $output; |
637 | 637 | $this->colorCli->primary('Finished task #'.$count.' for '.$desc); |
638 | - })->catch(function (\Throwable $exception) { |
|
638 | + })->catch(function(\Throwable $exception) { |
|
639 | 639 | echo $exception->getMessage(); |
640 | - })->catch(static function (SerializableException $serializableException) { |
|
640 | + })->catch(static function(SerializableException $serializableException) { |
|
641 | 641 | // we do nothing here just catch the error and move on |
642 | - })->timeout(function () use ($count) { |
|
642 | + })->timeout(function() use ($count) { |
|
643 | 643 | $this->colorCli->notice('Task #'.$count.': Timeout occurred.'); |
644 | 644 | }); |
645 | 645 | $count--; |
@@ -865,15 +865,15 @@ discard block |
||
865 | 865 | $pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time')); |
866 | 866 | $this->processWork(); |
867 | 867 | foreach ($this->work as $group) { |
868 | - $pool->add(function () use ($group) { |
|
868 | + $pool->add(function() use ($group) { |
|
869 | 869 | return $this->_executeCommand($this->dnr_path.'update_per_group '.$group->id.'"'); |
870 | - }, 2000000)->then(function ($output) use ($group) { |
|
870 | + }, 2000000)->then(function($output) use ($group) { |
|
871 | 871 | echo $output; |
872 | 872 | $name = UsenetGroup::getNameByID($group->id); |
873 | 873 | $this->colorCli->primary('Finished updating binaries, processing releases and additional postprocessing for group:'.$name); |
874 | - })->catch(function (\Throwable $exception) { |
|
874 | + })->catch(function(\Throwable $exception) { |
|
875 | 875 | echo $exception->getMessage(); |
876 | - })->catch(static function (SerializableException $serializableException) { |
|
876 | + })->catch(static function(SerializableException $serializableException) { |
|
877 | 877 | echo $serializableException->asThrowable()->getMessage(); |
878 | 878 | }); |
879 | 879 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | { |
890 | 890 | $process = Process::fromShellCommandline($command); |
891 | 891 | $process->setTimeout(1800); |
892 | - $process->run(function ($type, $buffer) { |
|
892 | + $process->run(function($type, $buffer) { |
|
893 | 893 | if ($type === Process::ERR) { |
894 | 894 | echo $buffer; |
895 | 895 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // reset collections dateadded to now if dateadded > delay time check |
21 | 21 | $colorCli->header('Resetting collections that have expired to this moment. This could take some time if many collections need to be reset'); |
22 | 22 | |
23 | -DB::transaction(function () use ($delaytime) { |
|
23 | +DB::transaction(function() use ($delaytime) { |
|
24 | 24 | Collection::query()->where('dateadded', '<', now()->subHours($delaytime))->update(['dateadded' => now()]); |
25 | 25 | }, 10); |
26 | 26 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // check for apps |
35 | 35 | $apps = ['time', 'tmux', 'nice', 'tee']; |
36 | 36 | foreach ($apps as &$value) { |
37 | - if (! command_exist($value)) { |
|
37 | + if (!command_exist($value)) { |
|
38 | 38 | $colorCli->error('Tmux scripts require '.$value.' but its not installed. Aborting.'); |
39 | 39 | exit(); |
40 | 40 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | $runVar['settings'] = (array) Arr::first(DB::select($tRun->getMonitorSettings())); |
78 | 78 | $runVar['timers']['query']['tmux_time'] = (time() - $timer01); |
79 | 79 | |
80 | - $runVar['settings']['book_reqids'] = (! empty($runVar['settings']['book_reqids']) |
|
80 | + $runVar['settings']['book_reqids'] = (!empty($runVar['settings']['book_reqids']) |
|
81 | 81 | ? $runVar['settings']['book_reqids'] : Category::BOOKS_ROOT); |
82 | 82 | |
83 | 83 | // get usenet connection info |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if (empty($email) && empty($rssToken)) { |
44 | 44 | app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset'); |
45 | 45 | } else { |
46 | - if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { |
|
46 | + if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) { |
|
47 | 47 | $validate = Validator::make($request->all(), [ |
48 | 48 | 'g-recaptcha-response' => 'required|captcha', |
49 | 49 | ]); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // |
55 | 55 | // Check users exists and send an email |
56 | 56 | // |
57 | - $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
57 | + $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
58 | 58 | if ($ret === null) { |
59 | 59 | app('smarty.view')->assign('error', 'The email or apikey are not recognised.'); |
60 | 60 | } else { |
@@ -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( |
@@ -658,11 +658,11 @@ discard block |
||
658 | 658 | $show = $this->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) && count($searchResult) !== 0) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
714 | + (!empty($name) && count($searchResult) !== 0) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
715 | 715 | Category::getCategorySearch($cat, 'tv'), |
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) && count($searchResult) !== 0) || empty($name)) ? $this->fromQuery($sql) : []; |
|
754 | + $releases = ((!empty($name) && count($searchResult) !== 0) || empty($name)) ? $this->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 = $this->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, 'tv'), |
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), |
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 && $imDbId) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
1002 | 1002 | ($tmDbId !== -1 && $tmDbId) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
1003 | 1003 | ($traktId !== -1 && $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, 'movies'), |
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 |