@@ -134,7 +134,7 @@ |
||
| 134 | 134 | return 0; |
| 135 | 135 | } |
| 136 | 136 | // Check if it's on the drive. |
| 137 | - if (! File::isReadable($coverPath)) { |
|
| 137 | + if (!File::isReadable($coverPath)) { |
|
| 138 | 138 | return 0; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->status = self::PROC_EXTFAIL; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if (! empty($hits['title'])) { |
|
| 184 | + if (!empty($hits['title'])) { |
|
| 185 | 185 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $anidbId = $this->getAnidbByName($tmpName); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 239 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 240 | 240 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
| 241 | 241 | |
| 242 | 242 | if ($updatedAni === null) { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0; |
| 344 | 344 | |
| 345 | - if (! Settings::settingValue('apps..ffmpegpath')) { |
|
| 345 | + if (!Settings::settingValue('apps..ffmpegpath')) { |
|
| 346 | 346 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
| 347 | 347 | } else { |
| 348 | 348 | $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; |
| 354 | 354 | $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== ''; |
| 355 | 355 | $this->_processAudioInfo = $this->_processMediaInfo; |
| 356 | - $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); |
|
| 356 | + $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath')); |
|
| 357 | 357 | |
| 358 | 358 | $this->_audioSavePath = storage_path('covers/audiosample/'); |
| 359 | 359 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $this->_mainTmpPath = (string) Settings::settingValue('..tmpunrarpath'); |
| 411 | 411 | |
| 412 | 412 | // Check if it ends with a dir separator. |
| 413 | - if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
| 413 | + if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
| 414 | 414 | $this->_mainTmpPath .= '/'; |
| 415 | 415 | } |
| 416 | 416 | |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | $this->_mainTmpPath .= ($guidChar.'/'); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 425 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
| 424 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 425 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
| 426 | 426 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 430 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 431 | 431 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
| 432 | 432 | } |
| 433 | 433 | |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | if ($this->_minSize > 0) { |
| 473 | 473 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
| 474 | 474 | } |
| 475 | - if (! empty($groupID)) { |
|
| 475 | + if (!empty($groupID)) { |
|
| 476 | 476 | $releasesQuery->where('releases.groups_id', $groupID); |
| 477 | 477 | } |
| 478 | - if (! empty($guidChar)) { |
|
| 478 | + if (!empty($guidChar)) { |
|
| 479 | 479 | $releasesQuery->where('releases.leftguid', $guidChar); |
| 480 | 480 | } |
| 481 | 481 | $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']) |
@@ -529,12 +529,12 @@ discard block |
||
| 529 | 529 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
| 530 | 530 | |
| 531 | 531 | // Create folder to store temporary files. |
| 532 | - if (! $this->_createTempFolder()) { |
|
| 532 | + if (!$this->_createTempFolder()) { |
|
| 533 | 533 | continue; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | // Get NZB contents. |
| 537 | - if (! $this->_getNZBContents()) { |
|
| 537 | + if (!$this->_getNZBContents()) { |
|
| 538 | 538 | continue; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $this->_processMessageIDDownloads(); |
| 557 | 557 | |
| 558 | 558 | // Process compressed (RAR/ZIP) files inside the NZB. |
| 559 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
| 559 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
| 560 | 560 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
| 561 | 561 | $this->_processNZBCompressedFiles(); |
| 562 | 562 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | $this->_processNZBCompressedFiles(true); |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | - if (! $this->_releaseHasPassword) { |
|
| 568 | + if (!$this->_releaseHasPassword) { |
|
| 569 | 569 | // Process the extracted files to get video/audio samples/etc. |
| 570 | 570 | $this->_processExtractedFiles(); |
| 571 | 571 | } |
@@ -610,8 +610,8 @@ discard block |
||
| 610 | 610 | { |
| 611 | 611 | // Per release defaults. |
| 612 | 612 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
| 613 | - if (! File::isDirectory($this->tmpPath)) { |
|
| 614 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
| 613 | + if (!File::isDirectory($this->tmpPath)) { |
|
| 614 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
| 615 | 615 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
| 616 | 616 | $this->_deleteRelease(); |
| 617 | 617 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
| 634 | 634 | if ($nzbPath !== false) { |
| 635 | 635 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
| 636 | - if (! $nzbContents) { |
|
| 636 | + if (!$nzbContents) { |
|
| 637 | 637 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
| 638 | 638 | $this->_deleteRelease(); |
| 639 | 639 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | // Check if it's a rar/zip. |
| 691 | - if (! $this->_NZBHasCompressedFile && |
|
| 691 | + if (!$this->_NZBHasCompressedFile && |
|
| 692 | 692 | preg_match( |
| 693 | 693 | '/\.(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', |
| 694 | 694 | $this->_currentNZBFile['title'] |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | // Look for a video sample, make sure it's not an image. |
| 701 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 701 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 702 | 702 | ) { |
| 703 | 703 | // Get the amount of segments for this file. |
| 704 | 704 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | // Look for a JPG picture, make sure it's not a CD cover. |
| 715 | - 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']) |
|
| 715 | + if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) |
|
| 716 | 716 | ) { |
| 717 | 717 | // Get the amount of segments for this file. |
| 718 | 718 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $this->_reverse = $reverse; |
| 765 | 765 | |
| 766 | 766 | if ($this->_reverse) { |
| 767 | - if (! krsort($this->_nzbContents)) { |
|
| 767 | + if (!krsort($this->_nzbContents)) { |
|
| 768 | 768 | return; |
| 769 | 769 | } |
| 770 | 770 | } else { |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Probably not a rar/zip. |
| 791 | - if (! preg_match( |
|
| 791 | + if (!preg_match( |
|
| 792 | 792 | '/\.(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', |
| 793 | 793 | $nzbFile['title'] |
| 794 | 794 | ) |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | break; |
| 805 | 805 | } |
| 806 | 806 | $segment = (string) $nzbFile['segments'][$i]; |
| 807 | - if (! $this->_reverse) { |
|
| 807 | + if (!$this->_reverse) { |
|
| 808 | 808 | $this->_triedCompressedMids[] = $segment; |
| 809 | 809 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
| 810 | 810 | // We already downloaded this file. |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | { |
| 857 | 857 | $this->_compressedFilesChecked++; |
| 858 | 858 | // Give the data to archive info so it can check if it's a rar. |
| 859 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
| 859 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
| 860 | 860 | if (config('app.debug') === true) { |
| 861 | 861 | $this->_debug('Data is probably not RAR or ZIP.'); |
| 862 | 862 | } |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | // Check if the compressed file is encrypted. |
| 889 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 889 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 890 | 890 | if (config('app.debug') === true) { |
| 891 | 891 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
| 892 | 892 | } |
@@ -898,13 +898,13 @@ discard block |
||
| 898 | 898 | |
| 899 | 899 | if ($this->_reverse) { |
| 900 | 900 | $fileData = $dataSummary['file_list'] ?? []; |
| 901 | - if (! empty($fileData)) { |
|
| 901 | + if (!empty($fileData)) { |
|
| 902 | 902 | $rarFileName = Arr::pluck($fileData, 'name'); |
| 903 | 903 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
| 904 | 904 | $preCheck = Predb::whereTitle($hit[0])->first(); |
| 905 | 905 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
| 906 | 906 | (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
| 907 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 907 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 908 | 908 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
| 909 | 909 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
| 910 | 910 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | $this->_echo('r', 'primaryOver'); |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 925 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 926 | 926 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
| 927 | 927 | File::put($fileName, $compressedData); |
| 928 | 928 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | $this->_echo('z', 'primaryOver'); |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
| 937 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
| 938 | 938 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
| 939 | 939 | File::put($fileName, $compressedData); |
| 940 | 940 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | { |
| 960 | 960 | // Get a list of files inside the Compressed file. |
| 961 | 961 | $files = $this->_archiveInfo->getArchiveFileList(); |
| 962 | - if (! \is_array($files) || \count($files) === 0) { |
|
| 962 | + if (!\is_array($files) || \count($files) === 0) { |
|
| 963 | 963 | return false; |
| 964 | 964 | } |
| 965 | 965 | |
@@ -1029,8 +1029,8 @@ discard block |
||
| 1029 | 1029 | protected function _addFileInfo(&$file): void |
| 1030 | 1030 | { |
| 1031 | 1031 | // Don't add rar/zip files to the DB. |
| 1032 | - if (! isset($file['error']) && isset($file['source']) && |
|
| 1033 | - ! 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']) |
|
| 1032 | + if (!isset($file['error']) && isset($file['source']) && |
|
| 1033 | + !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']) |
|
| 1034 | 1034 | ) { |
| 1035 | 1035 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
| 1036 | 1036 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
| 1043 | 1043 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
| 1044 | - if (! empty($addReleaseFiles)) { |
|
| 1044 | + if (!empty($addReleaseFiles)) { |
|
| 1045 | 1045 | $this->_addedFileInfo++; |
| 1046 | 1046 | |
| 1047 | 1047 | if ($this->_echoCLI) { |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | $this->_releaseHasPassword = true; |
| 1059 | 1059 | $this->_passwordStatus = Releases::PASSWD_RAR; |
| 1060 | 1060 | } //Run a PreDB filename check on insert to try and match the release |
| 1061 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
| 1061 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
| 1062 | 1062 | $this->_release['filename'] = $file['name']; |
| 1063 | 1063 | $this->_release['releases_id'] = $this->_release->id; |
| 1064 | 1064 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | // If we found no compressed files, break out. |
| 1107 | - if (! $foundCompressedFile) { |
|
| 1107 | + if (!$foundCompressedFile) { |
|
| 1108 | 1108 | break; |
| 1109 | 1109 | } |
| 1110 | 1110 | |
@@ -1126,39 +1126,39 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | if (File::isFile($file)) { |
| 1128 | 1128 | // Process PAR2 files. |
| 1129 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1129 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1130 | 1130 | $this->_siftPAR2Info($file); |
| 1131 | 1131 | } // Process NFO files. |
| 1132 | 1132 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
| 1133 | 1133 | $this->_processNfoFile($file); |
| 1134 | 1134 | } // Process audio files. |
| 1135 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1135 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1136 | 1136 | // Try to get audio sample/audio media info. |
| 1137 | 1137 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
| 1138 | 1138 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
| 1139 | 1139 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
| 1140 | 1140 | } // Process JPG files. |
| 1141 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1141 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1142 | 1142 | $this->_getJPGSample($file); |
| 1143 | 1143 | File::delete($file); |
| 1144 | 1144 | } // Video sample // video clip // video media info. |
| 1145 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1145 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1146 | 1146 | $this->_processVideoFile($file); |
| 1147 | 1147 | } // Check file's magic info. |
| 1148 | 1148 | else { |
| 1149 | 1149 | $output = Utility::fileInfo($file); |
| 1150 | - if (! empty($output)) { |
|
| 1150 | + if (!empty($output)) { |
|
| 1151 | 1151 | switch (true) { |
| 1152 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1152 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1153 | 1153 | $this->_getJPGSample($file); |
| 1154 | 1154 | File::delete($file); |
| 1155 | 1155 | break; |
| 1156 | 1156 | |
| 1157 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1157 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1158 | 1158 | $this->_processVideoFile($file); |
| 1159 | 1159 | break; |
| 1160 | 1160 | |
| 1161 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1161 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1162 | 1162 | switch ($fileType[0]) { |
| 1163 | 1163 | case 'FLAC': |
| 1164 | 1164 | $fileType = 'FLAC'; |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
| 1176 | 1176 | break; |
| 1177 | 1177 | |
| 1178 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1178 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1179 | 1179 | $this->_siftPAR2Info($file); |
| 1180 | 1180 | break; |
| 1181 | 1181 | } |
@@ -1211,8 +1211,8 @@ discard block |
||
| 1211 | 1211 | protected function _processSampleMessageIDs(): void |
| 1212 | 1212 | { |
| 1213 | 1213 | // Download and process sample image. |
| 1214 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1215 | - if (! empty($this->_sampleMessageIDs)) { |
|
| 1214 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
| 1215 | + if (!empty($this->_sampleMessageIDs)) { |
|
| 1216 | 1216 | // Download it from usenet. |
| 1217 | 1217 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
| 1218 | 1218 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1231,12 +1231,12 @@ discard block |
||
| 1231 | 1231 | File::put($fileLocation, $sampleBinary); |
| 1232 | 1232 | |
| 1233 | 1233 | // Try to get a sample picture. |
| 1234 | - if (! $this->_foundSample) { |
|
| 1234 | + if (!$this->_foundSample) { |
|
| 1235 | 1235 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | // Try to get a sample video. |
| 1239 | - if (! $this->_foundVideo) { |
|
| 1239 | + if (!$this->_foundVideo) { |
|
| 1240 | 1240 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1241 | 1241 | } |
| 1242 | 1242 | } |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | protected function _processMediaInfoMessageIDs(): void |
| 1258 | 1258 | { |
| 1259 | 1259 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
| 1260 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1261 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
| 1260 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
| 1261 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
| 1262 | 1262 | // Try to download it from usenet. |
| 1263 | 1263 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
| 1264 | 1264 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1278,17 +1278,17 @@ discard block |
||
| 1278 | 1278 | File::put($fileLocation, $mediaBinary); |
| 1279 | 1279 | |
| 1280 | 1280 | // Try to get media info. |
| 1281 | - if (! $this->_foundMediaInfo) { |
|
| 1281 | + if (!$this->_foundMediaInfo) { |
|
| 1282 | 1282 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | // Try to get a sample picture. |
| 1286 | - if (! $this->_foundSample) { |
|
| 1286 | + if (!$this->_foundSample) { |
|
| 1287 | 1287 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | // Try to get a sample video. |
| 1291 | - if (! $this->_foundVideo) { |
|
| 1291 | + if (!$this->_foundVideo) { |
|
| 1292 | 1292 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1293 | 1293 | } |
| 1294 | 1294 | } |
@@ -1309,8 +1309,8 @@ discard block |
||
| 1309 | 1309 | protected function _processAudioInfoMessageIDs(): void |
| 1310 | 1310 | { |
| 1311 | 1311 | // Download audio file, use media info to try to get the artist / album. |
| 1312 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
| 1313 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
| 1312 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
| 1313 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
| 1314 | 1314 | // Try to download it from usenet. |
| 1315 | 1315 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
| 1316 | 1316 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | protected function _processJPGMessageIDs(): void |
| 1346 | 1346 | { |
| 1347 | 1347 | // Download JPG file. |
| 1348 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
| 1348 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
| 1349 | 1349 | // Try to download it. |
| 1350 | 1350 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
| 1351 | 1351 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1418,12 +1418,12 @@ discard block |
||
| 1418 | 1418 | $this->_passwordStatus = max([$this->_passwordStatus]); |
| 1419 | 1419 | |
| 1420 | 1420 | // Set the release to no password if password processing is off. |
| 1421 | - if (! $this->_processPasswords) { |
|
| 1421 | + if (!$this->_processPasswords) { |
|
| 1422 | 1422 | $this->_releaseHasPassword = false; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password. |
| 1426 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1426 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1427 | 1427 | $release = Release::query()->where('id', $this->_release->id); |
| 1428 | 1428 | $release->decrement('passwordstatus'); |
| 1429 | 1429 | $release->update( |
@@ -1481,19 +1481,19 @@ discard block |
||
| 1481 | 1481 | $retVal = $audVal = false; |
| 1482 | 1482 | |
| 1483 | 1483 | // Check if audio sample fetching is on. |
| 1484 | - if (! $this->_processAudioSample) { |
|
| 1484 | + if (!$this->_processAudioSample) { |
|
| 1485 | 1485 | $audVal = true; |
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | 1488 | // Check if media info fetching is on. |
| 1489 | - if (! $this->_processAudioInfo) { |
|
| 1489 | + if (!$this->_processAudioInfo) { |
|
| 1490 | 1490 | $retVal = true; |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
| 1494 | 1494 | |
| 1495 | 1495 | $musicParent = (string) Category::MUSIC_ROOT; |
| 1496 | - if ($rQuery === null || ! preg_match( |
|
| 1496 | + if ($rQuery === null || !preg_match( |
|
| 1497 | 1497 | sprintf( |
| 1498 | 1498 | '/%d\d{3}|%d|%d|%d/', |
| 1499 | 1499 | $musicParent[0], |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | |
| 1510 | 1510 | if (File::isFile($fileLocation)) { |
| 1511 | 1511 | // Check if media info is enabled. |
| 1512 | - if (! $retVal) { |
|
| 1512 | + if (!$retVal) { |
|
| 1513 | 1513 | // Get the media info for the file. |
| 1514 | 1514 | try { |
| 1515 | 1515 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | $ext = strtoupper($fileExtension); |
| 1523 | 1523 | |
| 1524 | 1524 | // Form a new search name. |
| 1525 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1525 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1526 | 1526 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
| 1527 | 1527 | } else { |
| 1528 | 1528 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1584,7 +1584,7 @@ discard block |
||
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | // Check if creating audio samples is enabled. |
| 1587 | - if (! $audVal) { |
|
| 1587 | + if (!$audVal) { |
|
| 1588 | 1588 | // File name to store audio file. |
| 1589 | 1589 | $audioFileName = ($this->_release->guid.'.ogg'); |
| 1590 | 1590 | |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | // Try to move the temp audio file. |
| 1609 | 1609 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1610 | 1610 | |
| 1611 | - if (! $renamed) { |
|
| 1611 | + if (!$renamed) { |
|
| 1612 | 1612 | // Try to copy it if it fails. |
| 1613 | 1613 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1614 | 1614 | |
@@ -1616,7 +1616,7 @@ discard block |
||
| 1616 | 1616 | File::delete($this->tmpPath.$audioFileName); |
| 1617 | 1617 | |
| 1618 | 1618 | // If it didn't copy continue. |
| 1619 | - if (! $copied) { |
|
| 1619 | + if (!$copied) { |
|
| 1620 | 1620 | return false; |
| 1621 | 1621 | } |
| 1622 | 1622 | } |
@@ -1668,7 +1668,7 @@ discard block |
||
| 1668 | 1668 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1671 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1672 | 1672 | return ''; |
| 1673 | 1673 | } |
| 1674 | 1674 | |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | */ |
| 1690 | 1690 | protected function _getSample(string $fileLocation): bool |
| 1691 | 1691 | { |
| 1692 | - if (! $this->_processThumbnails) { |
|
| 1692 | + if (!$this->_processThumbnails) { |
|
| 1693 | 1693 | return false; |
| 1694 | 1694 | } |
| 1695 | 1695 | |
@@ -1754,7 +1754,7 @@ discard block |
||
| 1754 | 1754 | */ |
| 1755 | 1755 | protected function _getVideo(string $fileLocation): bool |
| 1756 | 1756 | { |
| 1757 | - if (! $this->_processVideo) { |
|
| 1757 | + if (!$this->_processVideo) { |
|
| 1758 | 1758 | return false; |
| 1759 | 1759 | } |
| 1760 | 1760 | |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | } |
| 1810 | 1810 | |
| 1811 | 1811 | // If longer than 60 or we could not get the video length, run the old way. |
| 1812 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1812 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1813 | 1813 | try { |
| 1814 | 1814 | $video = $this->ffmpeg->open($fileLocation); |
| 1815 | 1815 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1832,14 +1832,14 @@ discard block |
||
| 1832 | 1832 | |
| 1833 | 1833 | // Try to move the file to the new path. |
| 1834 | 1834 | // If we couldn't rename it, try to copy it. |
| 1835 | - if (! @File::move($fileName, $newFile)) { |
|
| 1835 | + if (!@File::move($fileName, $newFile)) { |
|
| 1836 | 1836 | $copied = @File::copy($fileName, $newFile); |
| 1837 | 1837 | |
| 1838 | 1838 | // Delete the old file. |
| 1839 | 1839 | File::delete($fileName); |
| 1840 | 1840 | |
| 1841 | 1841 | // If it didn't copy, continue. |
| 1842 | - if (! $copied) { |
|
| 1842 | + if (!$copied) { |
|
| 1843 | 1843 | return false; |
| 1844 | 1844 | } |
| 1845 | 1845 | } |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | */ |
| 1866 | 1866 | protected function _getMediaInfo($fileLocation): bool |
| 1867 | 1867 | { |
| 1868 | - if (! $this->_processMediaInfo) { |
|
| 1868 | + if (!$this->_processMediaInfo) { |
|
| 1869 | 1869 | return false; |
| 1870 | 1870 | } |
| 1871 | 1871 | |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | $filesAdded = 0; |
| 1941 | 1941 | |
| 1942 | 1942 | foreach ($this->_par2Info->getFileList() as $file) { |
| 1943 | - if (! isset($file['name'])) { |
|
| 1943 | + if (!isset($file['name'])) { |
|
| 1944 | 1944 | continue; |
| 1945 | 1945 | } |
| 1946 | 1946 | |
@@ -1963,7 +1963,7 @@ discard block |
||
| 1963 | 1963 | } |
| 1964 | 1964 | |
| 1965 | 1965 | // Try to get a new name. |
| 1966 | - if (! $foundName) { |
|
| 1966 | + if (!$foundName) { |
|
| 1967 | 1967 | $this->_release->textstring = $file['name']; |
| 1968 | 1968 | $this->_release->releases_id = $this->_release->id; |
| 1969 | 1969 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -1993,7 +1993,7 @@ discard block |
||
| 1993 | 1993 | protected function _processVideoFile($fileLocation): void |
| 1994 | 1994 | { |
| 1995 | 1995 | // Try to get a sample with it. |
| 1996 | - if (! $this->_foundSample) { |
|
| 1996 | + if (!$this->_foundSample) { |
|
| 1997 | 1997 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1998 | 1998 | } |
| 1999 | 1999 | |
@@ -2001,12 +2001,12 @@ discard block |
||
| 2001 | 2001 | * Don't get it here if _sampleMessageIDs is empty |
| 2002 | 2002 | * or has 1 message-id (Saves downloading another part). |
| 2003 | 2003 | */ |
| 2004 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 2004 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 2005 | 2005 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | 2008 | // Try to get media info with it. |
| 2009 | - if (! $this->_foundMediaInfo) { |
|
| 2009 | + if (!$this->_foundMediaInfo) { |
|
| 2010 | 2010 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 2011 | 2011 | } |
| 2012 | 2012 | } |
@@ -2028,24 +2028,24 @@ discard block |
||
| 2028 | 2028 | $bf = true; |
| 2029 | 2029 | } |
| 2030 | 2030 | |
| 2031 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2031 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2032 | 2032 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
| 2033 | 2033 | $af = true; |
| 2034 | 2034 | } |
| 2035 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2035 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2036 | 2036 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
| 2037 | 2037 | $bf = true; |
| 2038 | 2038 | } |
| 2039 | 2039 | |
| 2040 | - if (! $af && ! $bf) { |
|
| 2040 | + if (!$af && !$bf) { |
|
| 2041 | 2041 | return strnatcasecmp($a, $b); |
| 2042 | 2042 | } |
| 2043 | 2043 | |
| 2044 | - if (! $bf) { |
|
| 2044 | + if (!$bf) { |
|
| 2045 | 2045 | return -1; |
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | - if (! $af) { |
|
| 2048 | + if (!$af) { |
|
| 2049 | 2049 | return 1; |
| 2050 | 2050 | } |
| 2051 | 2051 | |
@@ -2070,12 +2070,12 @@ discard block |
||
| 2070 | 2070 | protected function _resetReleaseStatus(): void |
| 2071 | 2071 | { |
| 2072 | 2072 | // Only process for samples, previews and images if not disabled. |
| 2073 | - $this->_foundVideo = ! $this->_processVideo; |
|
| 2074 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
| 2075 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
| 2076 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
| 2077 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
| 2078 | - $this->_foundSample = ! $this->_processThumbnails; |
|
| 2073 | + $this->_foundVideo = !$this->_processVideo; |
|
| 2074 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
| 2075 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
| 2076 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
| 2077 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
| 2078 | + $this->_foundSample = !$this->_processThumbnails; |
|
| 2079 | 2079 | $this->_foundPAR2Info = false; |
| 2080 | 2080 | |
| 2081 | 2081 | $this->_passwordStatus = Releases::PASSWD_NONE; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if (\in_array($siteColumn, self::$sites, false)) { |
| 101 | 101 | $result = Video::query()->where($siteColumn, $siteID)->first(); |
| 102 | 102 | } |
| 103 | - if (! empty($result)) { |
|
| 103 | + if (!empty($result)) { |
|
| 104 | 104 | $query = $result->toArray(); |
| 105 | 105 | |
| 106 | 106 | return $query['id']; |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | public function getTitleExact(string $title, int $type, int $source = 0): int |
| 181 | 181 | { |
| 182 | 182 | $return = 0; |
| 183 | - if (! empty($title)) { |
|
| 183 | + if (!empty($title)) { |
|
| 184 | 184 | $sql = Video::query()->where(['title' => $title, 'type' => $type]); |
| 185 | 185 | if ($source > 0) { |
| 186 | 186 | $sql->where('source', $source); |
| 187 | 187 | } |
| 188 | 188 | $query = $sql->first(); |
| 189 | - if (! empty($query)) { |
|
| 189 | + if (!empty($query)) { |
|
| 190 | 190 | $result = $query->toArray(); |
| 191 | 191 | $return = $result['id']; |
| 192 | 192 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $sql->where('videos.source', $source); |
| 200 | 200 | } |
| 201 | 201 | $query = $sql->first(); |
| 202 | - if (! empty($query)) { |
|
| 202 | + if (!empty($query)) { |
|
| 203 | 203 | $result = $query->toArray(); |
| 204 | 204 | $return = $result['id']; |
| 205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | $return = 0; |
| 218 | 218 | |
| 219 | - if (! empty($title)) { |
|
| 219 | + if (!empty($title)) { |
|
| 220 | 220 | $sql = Video::query() |
| 221 | 221 | ->where('title', 'like', rtrim($title, '%')) |
| 222 | 222 | ->where('type', $type); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $sql->where('source', $source); |
| 225 | 225 | } |
| 226 | 226 | $query = $sql->first(); |
| 227 | - if (! empty($query)) { |
|
| 227 | + if (!empty($query)) { |
|
| 228 | 228 | $result = $query->toArray(); |
| 229 | 229 | $return = $result['id']; |
| 230 | 230 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $sql->where('videos.source', $source); |
| 239 | 239 | } |
| 240 | 240 | $query = $sql->first(); |
| 241 | - if (! empty($query)) { |
|
| 241 | + if (!empty($query)) { |
|
| 242 | 242 | $result = $query->toArray(); |
| 243 | 243 | $return = $result['id']; |
| 244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | public function getAlternativeTitleExact(string $title, int $type, int $source = 0): mixed |
| 255 | 255 | { |
| 256 | 256 | $return = 0; |
| 257 | - if (! empty($title)) { |
|
| 257 | + if (!empty($title)) { |
|
| 258 | 258 | if ($source > 0) { |
| 259 | 259 | $query = Video::query() |
| 260 | 260 | ->whereRaw("REPLACE(title,'\'','') = ?", $title) |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | ->where('type', '=', $type) |
| 270 | 270 | ->first(); |
| 271 | 271 | } |
| 272 | - if (! empty($query)) { |
|
| 272 | + if (!empty($query)) { |
|
| 273 | 273 | $result = $query->toArray(); |
| 274 | 274 | |
| 275 | 275 | return $result['id']; |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function addAliases($videoId, array $aliases = []): void |
| 286 | 286 | { |
| 287 | - if (! empty($aliases) && $videoId > 0) { |
|
| 287 | + if (!empty($aliases) && $videoId > 0) { |
|
| 288 | 288 | foreach ($aliases as $key => $title) { |
| 289 | 289 | // Check for tvmaze style aka |
| 290 | - if (\is_array($title) && ! empty($title['name'])) { |
|
| 290 | + if (\is_array($title) && !empty($title['name'])) { |
|
| 291 | 291 | $title = $title['name']; |
| 292 | 292 | } |
| 293 | 293 | // Check if we have the AKA already |
@@ -274,7 +274,7 @@ |
||
| 274 | 274 | |
| 275 | 275 | // Loop through the files. |
| 276 | 276 | foreach ($files as $file) { |
| 277 | - if (! isset($file['name'])) { |
|
| 277 | + if (!isset($file['name'])) { |
|
| 278 | 278 | continue; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $this->echoCLI = config('nntmux.echocli'); |
| 111 | 111 | $groupID = ''; |
| 112 | 112 | |
| 113 | - if (! empty($groupName)) { |
|
| 113 | + if (!empty($groupName)) { |
|
| 114 | 114 | $groupInfo = UsenetGroup::getByName($groupName); |
| 115 | 115 | if ($groupInfo !== null) { |
| 116 | 116 | $groupID = $groupInfo['id']; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if (! file_exists(Settings::settingValue('..nzbpath'))) { |
|
| 124 | + if (!file_exists(Settings::settingValue('..nzbpath'))) { |
|
| 125 | 125 | if ($this->echoCLI) { |
| 126 | 126 | $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')); |
| 127 | 127 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $cat = new Categorize(); |
| 183 | 183 | $categorized = $total = 0; |
| 184 | 184 | $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]); |
| 185 | - if (! empty($groupId)) { |
|
| 185 | + if (!empty($groupId)) { |
|
| 186 | 186 | $releasesQuery->where('groups_id', $groupId); |
| 187 | 187 | } |
| 188 | 188 | $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get(); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->colorCLI->header('Process Releases -> Attempting to find complete collections.'); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
| 221 | + $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
| 222 | 222 | |
| 223 | 223 | $this->processStuckCollections($groupID); |
| 224 | 224 | $this->collectionFileCheckStage1($groupID); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ($this->echoCLI) { |
| 232 | 232 | $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART); |
| 233 | 233 | |
| 234 | - if (! empty($groupID)) { |
|
| 234 | + if (!empty($groupID)) { |
|
| 235 | 235 | $countQuery->where('groups_id', $groupID); |
| 236 | 236 | } |
| 237 | 237 | $count = $countQuery->count('id'); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).'); |
| 259 | 259 | } |
| 260 | 260 | // Get the total size in bytes of the collection for collections where filecheck = 2. |
| 261 | - DB::transaction(function () use ($groupID, $startTime) { |
|
| 261 | + DB::transaction(function() use ($groupID, $startTime) { |
|
| 262 | 262 | $checked = DB::update( |
| 263 | 263 | sprintf( |
| 264 | 264 | ' |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | AND c.filesize = 0 %s', |
| 275 | 275 | self::COLLFC_SIZED, |
| 276 | 276 | self::COLLFC_COMPPART, |
| 277 | - (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
| 277 | + (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
| 278 | 278 | ) |
| 279 | 279 | ); |
| 280 | 280 | if ($checked > 0 && $this->echoCLI) { |
@@ -313,16 +313,16 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $groupMinimums = UsenetGroup::getGroupByID($grpID['id']); |
| 315 | 315 | if ($groupMinimums !== null) { |
| 316 | - if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
| 316 | + if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
| 317 | 317 | $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease']; |
| 318 | 318 | } |
| 319 | - if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
| 319 | + if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
| 320 | 320 | $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease']; |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) { |
| 325 | - DB::transaction(function () use ( |
|
| 325 | + DB::transaction(function() use ( |
|
| 326 | 326 | $groupMinSizeSetting, |
| 327 | 327 | $minSizeSetting, |
| 328 | 328 | $minSizeDeleted, |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $collectionsQuery = Collection::query() |
| 396 | 396 | ->where('collections.filecheck', self::COLLFC_SIZED) |
| 397 | 397 | ->where('collections.filesize', '>', 0); |
| 398 | - if (! empty($groupID)) { |
|
| 398 | + if (!empty($groupID)) { |
|
| 399 | 399 | $collectionsQuery->where('collections.groups_id', $groupID); |
| 400 | 400 | } |
| 401 | 401 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $releaseID = Release::insertRelease( |
| 451 | 451 | [ |
| 452 | 452 | 'name' => $cleanRelName, |
| 453 | - 'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
| 453 | + 'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
| 454 | 454 | 'totalpart' => $collection->totalfiles, |
| 455 | 455 | 'groups_id' => $collection->groups_id, |
| 456 | 456 | 'guid' => createGUID(), |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | if ($releaseID !== null) { |
| 468 | 468 | // Update collections table to say we inserted the release. |
| 469 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
| 469 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
| 470 | 470 | Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); |
| 471 | 471 | }, 10); |
| 472 | 472 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | } else { |
| 529 | 529 | // The release was already in the DB, so delete the collection. |
| 530 | - DB::transaction(static function () use ($collection) { |
|
| 530 | + DB::transaction(static function() use ($collection) { |
|
| 531 | 531 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
| 532 | 532 | }, 10); |
| 533 | 533 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0); |
| 571 | - if (! empty($groupID)) { |
|
| 571 | + if (!empty($groupID)) { |
|
| 572 | 572 | $releasesQuery->where('releases.groups_id', $groupID); |
| 573 | 573 | } |
| 574 | 574 | $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get(); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | ), true); |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - DB::transaction(function () use ($deletedCount, $startTime) { |
|
| 674 | + DB::transaction(function() use ($deletedCount, $startTime) { |
|
| 675 | 675 | $deleted = 0; |
| 676 | 676 | $deleteQuery = Collection::query() |
| 677 | 677 | ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours'))) |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | foreach ($genrelist as $genre) { |
| 887 | 887 | $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']); |
| 888 | 888 | $releases = Release::query() |
| 889 | - ->joinSub($musicInfoQuery, 'mi', function ($join) { |
|
| 889 | + ->joinSub($musicInfoQuery, 'mi', function($join) { |
|
| 890 | 890 | $join->on('releases.musicinfo_id', '=', 'mi.id'); |
| 891 | 891 | }) |
| 892 | 892 | ->select(['releases.id', 'releases.guid']) |
@@ -972,18 +972,18 @@ discard block |
||
| 972 | 972 | */ |
| 973 | 973 | private function collectionFileCheckStage1(int $groupID): void |
| 974 | 974 | { |
| 975 | - DB::transaction(static function () use ($groupID) { |
|
| 975 | + DB::transaction(static function() use ($groupID) { |
|
| 976 | 976 | $collectionsCheck = Collection::query()->select(['collections.id']) |
| 977 | 977 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
| 978 | 978 | ->where('collections.totalfiles', '>', 0) |
| 979 | 979 | ->where('collections.filecheck', '=', self::COLLFC_DEFAULT); |
| 980 | - if (! empty($groupID)) { |
|
| 980 | + if (!empty($groupID)) { |
|
| 981 | 981 | $collectionsCheck->where('collections.groups_id', $groupID); |
| 982 | 982 | } |
| 983 | 983 | $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id') |
| 984 | 984 | ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)'); |
| 985 | 985 | |
| 986 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
| 986 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
| 987 | 987 | $join->on('collections.id', '=', 'r.id'); |
| 988 | 988 | })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]); |
| 989 | 989 | }, 10); |
@@ -1004,25 +1004,25 @@ discard block |
||
| 1004 | 1004 | */ |
| 1005 | 1005 | private function collectionFileCheckStage2(int $groupID): void |
| 1006 | 1006 | { |
| 1007 | - DB::transaction(static function () use ($groupID) { |
|
| 1007 | + DB::transaction(static function() use ($groupID) { |
|
| 1008 | 1008 | $collectionsCheck = Collection::query()->select(['collections.id']) |
| 1009 | 1009 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
| 1010 | 1010 | ->where('binaries.filenumber', '=', 0) |
| 1011 | 1011 | ->where('collections.totalfiles', '>', 0) |
| 1012 | 1012 | ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL); |
| 1013 | - if (! empty($groupID)) { |
|
| 1013 | + if (!empty($groupID)) { |
|
| 1014 | 1014 | $collectionsCheck->where('collections.groups_id', $groupID); |
| 1015 | 1015 | } |
| 1016 | 1016 | $collectionsCheck->groupBy('collections.id'); |
| 1017 | 1017 | |
| 1018 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
| 1018 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
| 1019 | 1019 | $join->on('collections.id', '=', 'r.id'); |
| 1020 | 1020 | })->update(['collections.filecheck' => self::COLLFC_ZEROPART]); |
| 1021 | 1021 | }, 10); |
| 1022 | 1022 | |
| 1023 | - DB::transaction(static function () use ($groupID) { |
|
| 1023 | + DB::transaction(static function() use ($groupID) { |
|
| 1024 | 1024 | $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL); |
| 1025 | - if (! empty($groupID)) { |
|
| 1025 | + if (!empty($groupID)) { |
|
| 1026 | 1026 | $collectionQuery->where('groups_id', $groupID); |
| 1027 | 1027 | } |
| 1028 | 1028 | $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]); |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | */ |
| 1041 | 1041 | private function collectionFileCheckStage3(string $where): void |
| 1042 | 1042 | { |
| 1043 | - DB::transaction(static function () use ($where) { |
|
| 1043 | + DB::transaction(static function() use ($where) { |
|
| 1044 | 1044 | DB::update( |
| 1045 | 1045 | sprintf( |
| 1046 | 1046 | ' |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | ); |
| 1065 | 1065 | }, 10); |
| 1066 | 1066 | |
| 1067 | - DB::transaction(static function () use ($where) { |
|
| 1067 | + DB::transaction(static function() use ($where) { |
|
| 1068 | 1068 | DB::update( |
| 1069 | 1069 | sprintf( |
| 1070 | 1070 | ' |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | */ |
| 1102 | 1102 | private function collectionFileCheckStage4(string &$where): void |
| 1103 | 1103 | { |
| 1104 | - DB::transaction(static function () use ($where) { |
|
| 1104 | + DB::transaction(static function() use ($where) { |
|
| 1105 | 1105 | DB::update( |
| 1106 | 1106 | sprintf( |
| 1107 | 1107 | ' |
@@ -1131,9 +1131,9 @@ discard block |
||
| 1131 | 1131 | */ |
| 1132 | 1132 | private function collectionFileCheckStage5(int $groupId): void |
| 1133 | 1133 | { |
| 1134 | - DB::transaction(static function () use ($groupId) { |
|
| 1134 | + DB::transaction(static function() use ($groupId) { |
|
| 1135 | 1135 | $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]); |
| 1136 | - if (! empty($groupId)) { |
|
| 1136 | + if (!empty($groupId)) { |
|
| 1137 | 1137 | $collectionQuery->where('groups_id', $groupId); |
| 1138 | 1138 | } |
| 1139 | 1139 | $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]); |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | */ |
| 1152 | 1152 | private function collectionFileCheckStage6(string &$where): void |
| 1153 | 1153 | { |
| 1154 | - DB::transaction(function () use ($where) { |
|
| 1154 | + DB::transaction(function() use ($where) { |
|
| 1155 | 1155 | DB::update( |
| 1156 | 1156 | sprintf( |
| 1157 | 1157 | " |
@@ -1181,10 +1181,10 @@ discard block |
||
| 1181 | 1181 | { |
| 1182 | 1182 | $lastRun = Settings::settingValue('indexer.processing.last_run_time'); |
| 1183 | 1183 | |
| 1184 | - DB::transaction(function () use ($groupID, $lastRun) { |
|
| 1184 | + DB::transaction(function() use ($groupID, $lastRun) { |
|
| 1185 | 1185 | $objQuery = Collection::query() |
| 1186 | 1186 | ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout)); |
| 1187 | - if (! empty($groupID)) { |
|
| 1187 | + if (!empty($groupID)) { |
|
| 1188 | 1188 | $objQuery->where('groups_id', $groupID); |
| 1189 | 1189 | } |
| 1190 | 1190 | $obj = $objQuery->delete(); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Check for show aliases and try match those too |
| 268 | - if (\is_array($show->akas) && ! empty($show->akas)) { |
|
| 268 | + if (\is_array($show->akas) && !empty($show->akas)) { |
|
| 269 | 269 | foreach ($show->akas as $key => $aka) { |
| 270 | 270 | $matchPercent = $this->checkMatch(strtolower($aka['name']), strtolower($cleanName), $matchPercent); |
| 271 | 271 | if ($matchPercent > $highestMatch) { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $hasCover = 0; |
| 296 | 296 | |
| 297 | 297 | // Try to get the Poster |
| 298 | - if (! empty($this->posterUrl)) { |
|
| 298 | + if (!empty($this->posterUrl)) { |
|
| 299 | 299 | $hasCover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath); |
| 300 | 300 | |
| 301 | 301 | // Mark it retrieved if we saved an image |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | 'trakt' => 0, |
| 367 | 367 | 'tvrage' => (int) ($show->externalIDs['tvrage'] ?? 0), |
| 368 | 368 | 'tmdb' => 0, |
| 369 | - 'aliases' => ! empty($show->akas) ? (array) $show->akas : '', |
|
| 369 | + 'aliases' => !empty($show->akas) ? (array) $show->akas : '', |
|
| 370 | 370 | 'localzone' => "''", |
| 371 | 371 | ]; |
| 372 | 372 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | sleep(1); |
| 197 | 197 | |
| 198 | - if (\is_array($response) && ! empty($response['results'])) { |
|
| 198 | + if (\is_array($response) && !empty($response['results'])) { |
|
| 199 | 199 | $return = $this->matchShowInfo($response['results'], $name); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | - if (! empty($highest)) { |
|
| 231 | + if (!empty($highest)) { |
|
| 232 | 232 | try { |
| 233 | 233 | $showAlternativeTitles = TmdbClient::getTvApi()->getAlternativeTitles($highest['id']); |
| 234 | 234 | } catch (TmdbApiException $e) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $hascover = 0; |
| 266 | 266 | |
| 267 | 267 | // Try to get the Poster |
| 268 | - if (! empty($this->posterUrl)) { |
|
| 268 | + if (!empty($this->posterUrl)) { |
|
| 269 | 269 | $hascover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath); |
| 270 | 270 | |
| 271 | 271 | // Mark it retrieved if we saved an image |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | 'tvrage' => isset($show['external_ids']['tvrage_id']) ? (int) $show['external_ids']['tvrage_id'] : 0, |
| 330 | 330 | 'tvmaze' => 0, |
| 331 | 331 | 'tmdb' => (int) $show['id'], |
| 332 | - 'aliases' => ! empty($show['alternative_titles']) ? (array) $show['alternative_titles'] : '', |
|
| 332 | + 'aliases' => !empty($show['alternative_titles']) ? (array) $show['alternative_titles'] : '', |
|
| 333 | 333 | 'localzone' => "''", |
| 334 | 334 | ]; |
| 335 | 335 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if (\is_array($response)) { |
| 257 | 257 | foreach ($response as $show) { |
| 258 | - if (! is_bool($show)) { |
|
| 258 | + if (!is_bool($show)) { |
|
| 259 | 259 | // Check for exact title match first and then terminate if found |
| 260 | 260 | if ($show['show']['title'] === $name) { |
| 261 | 261 | $highest = $show; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | 'tvrage' => $show['ids']['tvrage'] ?? 0, |
| 309 | 309 | 'tvmaze' => 0, |
| 310 | 310 | 'tmdb' => $show['ids']['tmdb'] ?? 0, |
| 311 | - 'aliases' => isset($show['aliases']) && ! empty($show['aliases']) ? (array) $show['aliases'] : '', |
|
| 311 | + 'aliases' => isset($show['aliases']) && !empty($show['aliases']) ? (array) $show['aliases'] : '', |
|
| 312 | 312 | 'localzone' => $this->localizedTZ, |
| 313 | 313 | ]; |
| 314 | 314 | } |