@@ -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 | |
@@ -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 | } |
@@ -20,33 +20,33 @@ discard block |
||
| 20 | 20 | abstract class TV extends Videos |
| 21 | 21 | { |
| 22 | 22 | // Television Sources |
| 23 | - protected const SOURCE_NONE = 0; // No Scrape source |
|
| 23 | + protected const SOURCE_NONE = 0; // No Scrape source |
|
| 24 | 24 | |
| 25 | - protected const SOURCE_TVDB = 1; // Scrape source was TVDB |
|
| 25 | + protected const SOURCE_TVDB = 1; // Scrape source was TVDB |
|
| 26 | 26 | |
| 27 | - protected const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE |
|
| 27 | + protected const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE |
|
| 28 | 28 | |
| 29 | - protected const SOURCE_TMDB = 3; // Scrape source was TMDB |
|
| 29 | + protected const SOURCE_TMDB = 3; // Scrape source was TMDB |
|
| 30 | 30 | |
| 31 | - protected const SOURCE_TRAKT = 4; // Scrape source was Trakt |
|
| 31 | + protected const SOURCE_TRAKT = 4; // Scrape source was Trakt |
|
| 32 | 32 | |
| 33 | - protected const SOURCE_IMDB = 5; // Scrape source was IMDB |
|
| 33 | + protected const SOURCE_IMDB = 5; // Scrape source was IMDB |
|
| 34 | 34 | |
| 35 | 35 | // Anime Sources |
| 36 | - protected const SOURCE_ANIDB = 10; // Scrape source was AniDB |
|
| 36 | + protected const SOURCE_ANIDB = 10; // Scrape source was AniDB |
|
| 37 | 37 | |
| 38 | 38 | // Processing signifiers |
| 39 | - protected const PROCESS_TVDB = 0; // Process TVDB First |
|
| 39 | + protected const PROCESS_TVDB = 0; // Process TVDB First |
|
| 40 | 40 | |
| 41 | - protected const PROCESS_TVMAZE = -1; // Process TVMaze Second |
|
| 41 | + protected const PROCESS_TVMAZE = -1; // Process TVMaze Second |
|
| 42 | 42 | |
| 43 | - protected const PROCESS_TMDB = -2; // Process TMDB Third |
|
| 43 | + protected const PROCESS_TMDB = -2; // Process TMDB Third |
|
| 44 | 44 | |
| 45 | - protected const PROCESS_TRAKT = -3; // Process Trakt Fourth |
|
| 45 | + protected const PROCESS_TRAKT = -3; // Process Trakt Fourth |
|
| 46 | 46 | |
| 47 | - protected const PROCESS_IMDB = -4; // Process IMDB Fifth |
|
| 47 | + protected const PROCESS_IMDB = -4; // Process IMDB Fifth |
|
| 48 | 48 | |
| 49 | - protected const NO_MATCH_FOUND = -6; // Failed All Methods |
|
| 49 | + protected const NO_MATCH_FOUND = -6; // Failed All Methods |
|
| 50 | 50 | |
| 51 | 51 | protected const FAILED_PARSE = -100; // Failed Parsing |
| 52 | 52 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | 'localzone' => $show['localzone'], |
| 221 | 221 | ]); |
| 222 | 222 | // If we have AKAs\aliases, insert those as well |
| 223 | - if (! empty($show['aliases'])) { |
|
| 223 | + if (!empty($show['aliases'])) { |
|
| 224 | 224 | $this->addAliases($videoId, $show['aliases']); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $videoId |
| 285 | 285 | ) |
| 286 | 286 | ); |
| 287 | - if (! empty($show['aliases'])) { |
|
| 287 | + if (!empty($show['aliases'])) { |
|
| 288 | 288 | $this->addAliases($videoId, $show['aliases']); |
| 289 | 289 | } |
| 290 | 290 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function delete(int $id): mixed |
| 296 | 296 | { |
| 297 | - return DB::transaction(function () use ($id) { |
|
| 297 | + return DB::transaction(function() use ($id) { |
|
| 298 | 298 | DB::delete( |
| 299 | 299 | sprintf( |
| 300 | 300 | ' |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | { |
| 344 | 344 | if ($series > 0 && $episode > 0) { |
| 345 | 345 | $queryString = sprintf('tve.series = %d AND tve.episode = %d', $series, $episode); |
| 346 | - } elseif (! empty($airdate)) { |
|
| 346 | + } elseif (!empty($airdate)) { |
|
| 347 | 347 | $queryString = sprintf('DATE(tve.firstaired) = %s', escapeString(date('Y-m-d', strtotime($airdate)))); |
| 348 | 348 | } else { |
| 349 | 349 | return false; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | { |
| 383 | 383 | $showInfo['name'] = $this->parseName($relname); |
| 384 | 384 | |
| 385 | - if (! empty($showInfo['name'])) { |
|
| 385 | + if (!empty($showInfo['name'])) { |
|
| 386 | 386 | // Retrieve the country from the cleaned name |
| 387 | 387 | $showInfo['country'] = $this->parseCountry($showInfo['name']); |
| 388 | 388 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $showInfo += $this->parseSeasonEp($relname); |
| 394 | 394 | |
| 395 | 395 | if (isset($showInfo['season'], $showInfo['episode'])) { |
| 396 | - if (! isset($showInfo['airdate'])) { |
|
| 396 | + if (!isset($showInfo['airdate'])) { |
|
| 397 | 397 | // If year is present in the release name, add it to the cleaned name for title search |
| 398 | 398 | if (preg_match('/[^a-z0-9](?P<year>(19|20)(\d{2}))[^a-z0-9]/i', $relname, $yearMatch)) { |
| 399 | 399 | $showInfo['cleanname'] .= ' ('.$yearMatch['year'].')'; |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | */ |
| 609 | 609 | public function checkDate(bool|string|null $date): string |
| 610 | 610 | { |
| 611 | - if (! empty($date)) { |
|
| 611 | + if (!empty($date)) { |
|
| 612 | 612 | $chk = explode(' ', $date); |
| 613 | 613 | $chkd = explode('-', $chk[0]); |
| 614 | 614 | if ($chkd[1] > 12) { |
@@ -657,11 +657,11 @@ discard block |
||
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | foreach ($required as $req) { |
| 660 | - if (! \in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'], false)) { |
|
| 661 | - if (! isset($array->$req)) { |
|
| 660 | + if (!\in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'], false)) { |
|
| 661 | + if (!isset($array->$req)) { |
|
| 662 | 662 | return false; |
| 663 | 663 | } |
| 664 | - } elseif (! isset($array[$req])) { |
|
| 664 | + } elseif (!isset($array[$req])) { |
|
| 665 | 665 | return false; |
| 666 | 666 | } |
| 667 | 667 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if ((int) $videoId > 0 && (int) $tvDbId > 0) { |
| 144 | - if (! empty($tvdbShow['poster'])) { // Use TVDB poster if available |
|
| 144 | + if (!empty($tvdbShow['poster'])) { // Use TVDB poster if available |
|
| 145 | 145 | $this->getPoster($videoId); |
| 146 | 146 | } else { // Check Fanart.tv for poster |
| 147 | 147 | $poster = $this->fanart->getTVFanart($tvDbId); |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $seasonNo = (! empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : ''); |
|
| 155 | - $episodeNo = (! empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : ''); |
|
| 154 | + $seasonNo = (!empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : ''); |
|
| 155 | + $episodeNo = (!empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : ''); |
|
| 156 | 156 | |
| 157 | 157 | if ($episodeNo === 'all') { |
| 158 | 158 | // Set the video ID and leave episode 0 |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Download all episodes if new show to reduce API/bandwidth usage |
| 166 | - if (! $this->countEpsByVideoID($videoId)) { |
|
| 166 | + if (!$this->countEpsByVideoID($videoId)) { |
|
| 167 | 167 | $this->getEpisodeInfo($tvDbId, -1, -1, $videoId); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // Check for show aliases and try match those too |
| 260 | - if (! empty($show->aliases)) { |
|
| 260 | + if (!empty($show->aliases)) { |
|
| 261 | 261 | foreach ($show->aliases as $key => $name) { |
| 262 | 262 | $matchPercent = $this->checkMatch(strtolower($name), strtolower($name), $matchPercent); |
| 263 | 263 | if ($matchPercent > $highestMatch) { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | - if (! empty($highest)) { |
|
| 271 | + if (!empty($highest)) { |
|
| 272 | 272 | $return = $this->formatShowInfo($highest); |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $poster = $this->client->series()->artworks($show->tvdb_id); |
| 354 | 354 | // Grab the image with the highest score where type == 2 |
| 355 | 355 | $poster = collect($poster)->where('type', 2)->sortByDesc('score')->first(); |
| 356 | - $this->posterUrl = ! empty($poster->image) ? $poster->image : ''; |
|
| 356 | + $this->posterUrl = !empty($poster->image) ? $poster->image : ''; |
|
| 357 | 357 | } catch (ResourceNotFoundException $e) { |
| 358 | 358 | $this->colorCli->climate()->error('Poster image not found on TVDB'); |
| 359 | 359 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | 'tvrage' => 0, |
| 380 | 380 | 'tvmaze' => 0, |
| 381 | 381 | 'tmdb' => 0, |
| 382 | - 'aliases' => ! empty($show->aliases) ? $show->aliases : '', |
|
| 382 | + 'aliases' => !empty($show->aliases) ? $show->aliases : '', |
|
| 383 | 383 | 'localzone' => "''", |
| 384 | 384 | ]; |
| 385 | 385 | } |