@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function handle(Request $request, Closure $next): Response |
| 18 | 18 | { |
| 19 | 19 | // Force Json accept type on api routes |
| 20 | - if ($request->is('api/*') && ! Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
| 20 | + if ($request->is('api/*') && !Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
| 21 | 21 | $request->headers->set('accept', 'application/json,'.$request->header('accept')); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | // Pass the binary extractors to ArchiveInfo. |
| 287 | 287 | $clients = []; |
| 288 | - if (! empty(Settings::settingValue('apps..unrarpath'))) { |
|
| 288 | + if (!empty(Settings::settingValue('apps..unrarpath'))) { |
|
| 289 | 289 | $this->_unrarPath = Settings::settingValue('apps..unrarpath'); |
| 290 | 290 | $clients += [ArchiveInfo::TYPE_RAR => $this->_unrarPath]; |
| 291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $this->_archiveInfo->setExternalClients($clients); |
| 294 | 294 | |
| 295 | 295 | $this->_killString = '"'; |
| 296 | - if (! empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
| 296 | + if (!empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
| 297 | 297 | $this->_killString = ( |
| 298 | 298 | '"'.Settings::settingValue('apps..timeoutpath'). |
| 299 | 299 | '" --foreground --signal=KILL '. |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0; |
| 335 | 335 | |
| 336 | - if (! Settings::settingValue('apps..ffmpegpath')) { |
|
| 336 | + if (!Settings::settingValue('apps..ffmpegpath')) { |
|
| 337 | 337 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
| 338 | 338 | } else { |
| 339 | 339 | $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; |
| 345 | 345 | $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== ''; |
| 346 | 346 | $this->_processAudioInfo = $this->_processMediaInfo; |
| 347 | - $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); |
|
| 347 | + $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath')); |
|
| 348 | 348 | |
| 349 | 349 | $this->_audioSavePath = storage_path('covers/audiosample/'); |
| 350 | 350 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | $this->_mainTmpPath = config('nntmux.tmp_unrar_path'); |
| 402 | 402 | |
| 403 | 403 | // Check if it ends with a dir separator. |
| 404 | - if (! Str::endsWith($this->_mainTmpPath, '/') && ! Str::endsWith($this->_mainTmpPath, '\\')) { |
|
| 404 | + if (!Str::endsWith($this->_mainTmpPath, '/') && !Str::endsWith($this->_mainTmpPath, '\\')) { |
|
| 405 | 405 | $this->_mainTmpPath .= '/'; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -412,13 +412,13 @@ discard block |
||
| 412 | 412 | $this->_mainTmpPath .= $guidChar.'/'; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 416 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
| 415 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 416 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
| 417 | 417 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
| 421 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
| 422 | 422 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
| 423 | 423 | } |
| 424 | 424 | |
@@ -456,10 +456,10 @@ discard block |
||
| 456 | 456 | if ($this->_minSize > 0) { |
| 457 | 457 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
| 458 | 458 | } |
| 459 | - if (! empty($groupID)) { |
|
| 459 | + if (!empty($groupID)) { |
|
| 460 | 460 | $releasesQuery->where('releases.groups_id', $groupID); |
| 461 | 461 | } |
| 462 | - if (! empty($guidChar)) { |
|
| 462 | + if (!empty($guidChar)) { |
|
| 463 | 463 | $releasesQuery->where('releases.leftguid', $guidChar); |
| 464 | 464 | } |
| 465 | 465 | $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']) |
@@ -513,12 +513,12 @@ discard block |
||
| 513 | 513 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
| 514 | 514 | |
| 515 | 515 | // Create folder to store temporary files. |
| 516 | - if (! $this->_createTempFolder()) { |
|
| 516 | + if (!$this->_createTempFolder()) { |
|
| 517 | 517 | continue; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | // Get NZB contents. |
| 521 | - if (! $this->_getNZBContents()) { |
|
| 521 | + if (!$this->_getNZBContents()) { |
|
| 522 | 522 | continue; |
| 523 | 523 | } |
| 524 | 524 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $this->_processMessageIDDownloads(); |
| 541 | 541 | |
| 542 | 542 | // Process compressed (RAR/ZIP) files inside the NZB. |
| 543 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
| 543 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
| 544 | 544 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
| 545 | 545 | $this->_processNZBCompressedFiles(); |
| 546 | 546 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | $this->_processNZBCompressedFiles(true); |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if (! $this->_releaseHasPassword) { |
|
| 552 | + if (!$this->_releaseHasPassword) { |
|
| 553 | 553 | // Process the extracted files to get video/audio samples/etc. |
| 554 | 554 | $this->_processExtractedFiles(); |
| 555 | 555 | } |
@@ -593,10 +593,10 @@ discard block |
||
| 593 | 593 | { |
| 594 | 594 | // Per release defaults. |
| 595 | 595 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
| 596 | - if (! File::isDirectory($this->tmpPath)) { |
|
| 597 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
| 596 | + if (!File::isDirectory($this->tmpPath)) { |
|
| 597 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
| 598 | 598 | // We will try to create the main temp folder again, just in case there was a file lock or filesystem issue. |
| 599 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
| 599 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
| 600 | 600 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
| 601 | 601 | |
| 602 | 602 | return false; |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
| 619 | 619 | if ($nzbPath !== false) { |
| 620 | 620 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
| 621 | - if (! $nzbContents) { |
|
| 621 | + if (!$nzbContents) { |
|
| 622 | 622 | if ($this->_echoCLI) { |
| 623 | 623 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
| 624 | 624 | } |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | // Check if it's a rar/zip. |
| 682 | - if (! $this->_NZBHasCompressedFile && |
|
| 682 | + if (!$this->_NZBHasCompressedFile && |
|
| 683 | 683 | preg_match( |
| 684 | 684 | '/\.(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', |
| 685 | 685 | $this->_currentNZBFile['title'] |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Look for a video sample, make sure it's not an image. |
| 692 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 692 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
| 693 | 693 | ) { |
| 694 | 694 | // Get the amount of segments for this file. |
| 695 | 695 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | // Look for a JPG picture, make sure it's not a CD cover. |
| 706 | - 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']) |
|
| 706 | + 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']) |
|
| 707 | 707 | ) { |
| 708 | 708 | // Get the amount of segments for this file. |
| 709 | 709 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $this->_reverse = $reverse; |
| 756 | 756 | |
| 757 | 757 | if ($this->_reverse) { |
| 758 | - if (! krsort($this->_nzbContents)) { |
|
| 758 | + if (!krsort($this->_nzbContents)) { |
|
| 759 | 759 | return; |
| 760 | 760 | } |
| 761 | 761 | } else { |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | // Probably not a rar/zip. |
| 782 | - if (! preg_match( |
|
| 782 | + if (!preg_match( |
|
| 783 | 783 | '/\.(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', |
| 784 | 784 | $nzbFile['title'] |
| 785 | 785 | ) |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | break; |
| 796 | 796 | } |
| 797 | 797 | $segment = (string) $nzbFile['segments'][$i]; |
| 798 | - if (! $this->_reverse) { |
|
| 798 | + if (!$this->_reverse) { |
|
| 799 | 799 | $this->_triedCompressedMids[] = $segment; |
| 800 | 800 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
| 801 | 801 | // We already downloaded this file. |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | { |
| 848 | 848 | $this->_compressedFilesChecked++; |
| 849 | 849 | // Give the data to archive info, so it can check if it's a rar. |
| 850 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
| 850 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
| 851 | 851 | if (config('app.debug') === true) { |
| 852 | 852 | $this->_debug('Data is probably not RAR or ZIP.'); |
| 853 | 853 | } |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | // Check if the compressed file is encrypted. |
| 880 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 880 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
| 881 | 881 | if (config('app.debug') === true) { |
| 882 | 882 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
| 883 | 883 | } |
@@ -889,13 +889,13 @@ discard block |
||
| 889 | 889 | |
| 890 | 890 | if ($this->_reverse) { |
| 891 | 891 | $fileData = $dataSummary['file_list'] ?? []; |
| 892 | - if (! empty($fileData)) { |
|
| 892 | + if (!empty($fileData)) { |
|
| 893 | 893 | $rarFileName = Arr::pluck($fileData, 'name'); |
| 894 | 894 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
| 895 | 895 | $preCheck = Predb::whereTitle($hit[0])->first(); |
| 896 | 896 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
| 897 | 897 | (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
| 898 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 898 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 899 | 899 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
| 900 | 900 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
| 901 | 901 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | $this->_echo('r', 'primaryOver'); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 916 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
| 917 | 917 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
| 918 | 918 | File::put($fileName, $compressedData); |
| 919 | 919 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | if ($this->_echoCLI) { |
| 925 | 925 | $this->_echo('z', 'primaryOver'); |
| 926 | 926 | } |
| 927 | - if (! $this->_extractUsingRarInfo) { |
|
| 927 | + if (!$this->_extractUsingRarInfo) { |
|
| 928 | 928 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
| 929 | 929 | File::put($fileName, $compressedData); |
| 930 | 930 | // Use the unzip command instead of 7zip |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | { |
| 950 | 950 | // Get a list of files inside the Compressed file. |
| 951 | 951 | $files = $this->_archiveInfo->getArchiveFileList(); |
| 952 | - if (! \is_array($files) || \count($files) === 0) { |
|
| 952 | + if (!\is_array($files) || \count($files) === 0) { |
|
| 953 | 953 | return false; |
| 954 | 954 | } |
| 955 | 955 | |
@@ -1019,8 +1019,8 @@ discard block |
||
| 1019 | 1019 | protected function _addFileInfo(&$file): void |
| 1020 | 1020 | { |
| 1021 | 1021 | // Don't add rar/zip files to the DB. |
| 1022 | - if (! isset($file['error']) && isset($file['source']) && |
|
| 1023 | - ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) |
|
| 1022 | + if (!isset($file['error']) && isset($file['source']) && |
|
| 1023 | + !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']) |
|
| 1024 | 1024 | ) { |
| 1025 | 1025 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
| 1026 | 1026 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | */ |
| 1032 | 1032 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
| 1033 | 1033 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
| 1034 | - if (! empty($addReleaseFiles)) { |
|
| 1034 | + if (!empty($addReleaseFiles)) { |
|
| 1035 | 1035 | $this->_addedFileInfo++; |
| 1036 | 1036 | |
| 1037 | 1037 | if ($this->_echoCLI) { |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | $this->_releaseHasPassword = true; |
| 1047 | 1047 | $this->_passwordStatus = Releases::PASSWD_RAR; |
| 1048 | 1048 | } //Run a PreDB filename check on insert to try and match the release |
| 1049 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
| 1049 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
| 1050 | 1050 | $this->_release['filename'] = $file['name']; |
| 1051 | 1051 | $this->_release['releases_id'] = $this->_release->id; |
| 1052 | 1052 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1077,12 +1077,12 @@ discard block |
||
| 1077 | 1077 | // Get all the compressed files in the temp folder. |
| 1078 | 1078 | $files = $this->_getTempDirectoryContents('/.*\.([rz]\d{2,}|rar|zipx?|0{0,2}1)($|[^a-z0-9])/i'); |
| 1079 | 1079 | |
| 1080 | - if (! empty($files)) { |
|
| 1080 | + if (!empty($files)) { |
|
| 1081 | 1081 | foreach ($files as $file) { |
| 1082 | 1082 | // Check if the file exists. |
| 1083 | 1083 | if (File::isFile($file[0])) { |
| 1084 | 1084 | $rarData = @File::get($file[0]); |
| 1085 | - if (! empty($rarData)) { |
|
| 1085 | + if (!empty($rarData)) { |
|
| 1086 | 1086 | $this->_processCompressedData($rarData); |
| 1087 | 1087 | $foundCompressedFile = true; |
| 1088 | 1088 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | 1094 | // If we found no compressed files, break out. |
| 1095 | - if (! $foundCompressedFile) { |
|
| 1095 | + if (!$foundCompressedFile) { |
|
| 1096 | 1096 | break; |
| 1097 | 1097 | } |
| 1098 | 1098 | |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | |
| 1104 | 1104 | // Get all the remaining files in the temp dir. |
| 1105 | 1105 | $files = $this->_getTempDirectoryContents(); |
| 1106 | - if (! empty($files)) { |
|
| 1106 | + if (!empty($files)) { |
|
| 1107 | 1107 | foreach ($files as $file) { |
| 1108 | 1108 | $file = $file->getPathname(); |
| 1109 | 1109 | |
@@ -1114,39 +1114,39 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | if (File::isFile($file)) { |
| 1116 | 1116 | // Process PAR2 files. |
| 1117 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1117 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
| 1118 | 1118 | $this->_siftPAR2Info($file); |
| 1119 | 1119 | } // Process NFO files. |
| 1120 | 1120 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
| 1121 | 1121 | $this->_processNfoFile($file); |
| 1122 | 1122 | } // Process audio files. |
| 1123 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1123 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
| 1124 | 1124 | // Try to get audio sample/audio media info. |
| 1125 | 1125 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
| 1126 | 1126 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
| 1127 | 1127 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
| 1128 | 1128 | } // Process JPG files. |
| 1129 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1129 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
| 1130 | 1130 | $this->_getJPGSample($file); |
| 1131 | 1131 | File::delete($file); |
| 1132 | 1132 | } // Video sample // video clip // video media info. |
| 1133 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1133 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
| 1134 | 1134 | $this->_processVideoFile($file); |
| 1135 | 1135 | } // Check file's magic info. |
| 1136 | 1136 | else { |
| 1137 | 1137 | $output = Utility::fileInfo($file); |
| 1138 | - if (! empty($output)) { |
|
| 1138 | + if (!empty($output)) { |
|
| 1139 | 1139 | switch (true) { |
| 1140 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1140 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
| 1141 | 1141 | $this->_getJPGSample($file); |
| 1142 | 1142 | File::delete($file); |
| 1143 | 1143 | break; |
| 1144 | 1144 | |
| 1145 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1145 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
| 1146 | 1146 | $this->_processVideoFile($file); |
| 1147 | 1147 | break; |
| 1148 | 1148 | |
| 1149 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1149 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
| 1150 | 1150 | switch ($fileType[0]) { |
| 1151 | 1151 | case 'FLAC': |
| 1152 | 1152 | $fileType = 'FLAC'; |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
| 1164 | 1164 | break; |
| 1165 | 1165 | |
| 1166 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1166 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
| 1167 | 1167 | $this->_siftPAR2Info($file); |
| 1168 | 1168 | break; |
| 1169 | 1169 | } |
@@ -1199,8 +1199,8 @@ discard block |
||
| 1199 | 1199 | protected function _processSampleMessageIDs(): void |
| 1200 | 1200 | { |
| 1201 | 1201 | // Download and process sample image. |
| 1202 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1203 | - if (! empty($this->_sampleMessageIDs)) { |
|
| 1202 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
| 1203 | + if (!empty($this->_sampleMessageIDs)) { |
|
| 1204 | 1204 | // Download it from usenet. |
| 1205 | 1205 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
| 1206 | 1206 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1219,12 +1219,12 @@ discard block |
||
| 1219 | 1219 | File::put($fileLocation, $sampleBinary); |
| 1220 | 1220 | |
| 1221 | 1221 | // Try to get a sample picture. |
| 1222 | - if (! $this->_foundSample) { |
|
| 1222 | + if (!$this->_foundSample) { |
|
| 1223 | 1223 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | // Try to get a sample video. |
| 1227 | - if (! $this->_foundVideo) { |
|
| 1227 | + if (!$this->_foundVideo) { |
|
| 1228 | 1228 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1229 | 1229 | } |
| 1230 | 1230 | } |
@@ -1245,8 +1245,8 @@ discard block |
||
| 1245 | 1245 | protected function _processMediaInfoMessageIDs(): void |
| 1246 | 1246 | { |
| 1247 | 1247 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
| 1248 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
| 1249 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
| 1248 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
| 1249 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
| 1250 | 1250 | // Try to download it from usenet. |
| 1251 | 1251 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
| 1252 | 1252 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1266,17 +1266,17 @@ discard block |
||
| 1266 | 1266 | File::put($fileLocation, $mediaBinary); |
| 1267 | 1267 | |
| 1268 | 1268 | // Try to get media info. |
| 1269 | - if (! $this->_foundMediaInfo) { |
|
| 1269 | + if (!$this->_foundMediaInfo) { |
|
| 1270 | 1270 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | // Try to get a sample picture. |
| 1274 | - if (! $this->_foundSample) { |
|
| 1274 | + if (!$this->_foundSample) { |
|
| 1275 | 1275 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | // Try to get a sample video. |
| 1279 | - if (! $this->_foundVideo) { |
|
| 1279 | + if (!$this->_foundVideo) { |
|
| 1280 | 1280 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1281 | 1281 | } |
| 1282 | 1282 | } |
@@ -1297,8 +1297,8 @@ discard block |
||
| 1297 | 1297 | protected function _processAudioInfoMessageIDs(): void |
| 1298 | 1298 | { |
| 1299 | 1299 | // Download audio file, use media info to try to get the artist / album. |
| 1300 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
| 1301 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
| 1300 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
| 1301 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
| 1302 | 1302 | // Try to download it from usenet. |
| 1303 | 1303 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
| 1304 | 1304 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | protected function _processJPGMessageIDs(): void |
| 1334 | 1334 | { |
| 1335 | 1335 | // Download JPG file. |
| 1336 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
| 1336 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
| 1337 | 1337 | // Try to download it. |
| 1338 | 1338 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
| 1339 | 1339 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1402,12 +1402,12 @@ discard block |
||
| 1402 | 1402 | $this->_passwordStatus = max([$this->_passwordStatus]); |
| 1403 | 1403 | |
| 1404 | 1404 | // Set the release to no password if password processing is off. |
| 1405 | - if (! $this->_processPasswords) { |
|
| 1405 | + if (!$this->_processPasswords) { |
|
| 1406 | 1406 | $this->_releaseHasPassword = false; |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | // If we failed to get anything from the RAR/ZIPs update the release with what we have, if the rar/zip has no password. |
| 1410 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1410 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
| 1411 | 1411 | $release = Release::query()->where('id', $this->_release->id); |
| 1412 | 1412 | $release->update( |
| 1413 | 1413 | $updateRows |
@@ -1461,19 +1461,19 @@ discard block |
||
| 1461 | 1461 | $retVal = $audVal = false; |
| 1462 | 1462 | |
| 1463 | 1463 | // Check if audio sample fetching is on. |
| 1464 | - if (! $this->_processAudioSample) { |
|
| 1464 | + if (!$this->_processAudioSample) { |
|
| 1465 | 1465 | $audVal = true; |
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | // Check if media info fetching is on. |
| 1469 | - if (! $this->_processAudioInfo) { |
|
| 1469 | + if (!$this->_processAudioInfo) { |
|
| 1470 | 1470 | $retVal = true; |
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
| 1474 | 1474 | |
| 1475 | 1475 | $musicParent = (string) Category::MUSIC_ROOT; |
| 1476 | - if ($rQuery === null || ! preg_match( |
|
| 1476 | + if ($rQuery === null || !preg_match( |
|
| 1477 | 1477 | sprintf( |
| 1478 | 1478 | '/%d\d{3}|%d|%d|%d/', |
| 1479 | 1479 | $musicParent[0], |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | |
| 1490 | 1490 | if (File::isFile($fileLocation)) { |
| 1491 | 1491 | // Check if media info is enabled. |
| 1492 | - if (! $retVal) { |
|
| 1492 | + if (!$retVal) { |
|
| 1493 | 1493 | // Get the media info for the file. |
| 1494 | 1494 | try { |
| 1495 | 1495 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | $ext = strtoupper($fileExtension); |
| 1503 | 1503 | |
| 1504 | 1504 | // Form a new search name. |
| 1505 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1505 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 1506 | 1506 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
| 1507 | 1507 | } else { |
| 1508 | 1508 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1564,7 +1564,7 @@ discard block |
||
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | // Check if creating audio samples is enabled. |
| 1567 | - if (! $audVal) { |
|
| 1567 | + if (!$audVal) { |
|
| 1568 | 1568 | // File name to store audio file. |
| 1569 | 1569 | $audioFileName = ($this->_release->guid.'.ogg'); |
| 1570 | 1570 | |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | // Try to move the temp audio file. |
| 1589 | 1589 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1590 | 1590 | |
| 1591 | - if (! $renamed) { |
|
| 1591 | + if (!$renamed) { |
|
| 1592 | 1592 | // Try to copy it if it fails. |
| 1593 | 1593 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
| 1594 | 1594 | |
@@ -1596,7 +1596,7 @@ discard block |
||
| 1596 | 1596 | File::delete($this->tmpPath.$audioFileName); |
| 1597 | 1597 | |
| 1598 | 1598 | // If it didn't copy continue. |
| 1599 | - if (! $copied) { |
|
| 1599 | + if (!$copied) { |
|
| 1600 | 1600 | return false; |
| 1601 | 1601 | } |
| 1602 | 1602 | } |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1651 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 1652 | 1652 | return ''; |
| 1653 | 1653 | } |
| 1654 | 1654 | |
@@ -1669,7 +1669,7 @@ discard block |
||
| 1669 | 1669 | */ |
| 1670 | 1670 | protected function _getSample(string $fileLocation): bool |
| 1671 | 1671 | { |
| 1672 | - if (! $this->_processThumbnails) { |
|
| 1672 | + if (!$this->_processThumbnails) { |
|
| 1673 | 1673 | return false; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | */ |
| 1735 | 1735 | protected function _getVideo(string $fileLocation): bool |
| 1736 | 1736 | { |
| 1737 | - if (! $this->_processVideo) { |
|
| 1737 | + if (!$this->_processVideo) { |
|
| 1738 | 1738 | return false; |
| 1739 | 1739 | } |
| 1740 | 1740 | |
@@ -1789,7 +1789,7 @@ discard block |
||
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | 1791 | // If longer than 60 or we could not get the video length, run the old way. |
| 1792 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1792 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 1793 | 1793 | try { |
| 1794 | 1794 | $video = $this->ffmpeg->open($fileLocation); |
| 1795 | 1795 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1812,14 +1812,14 @@ discard block |
||
| 1812 | 1812 | |
| 1813 | 1813 | // Try to move the file to the new path. |
| 1814 | 1814 | // If we couldn't rename it, try to copy it. |
| 1815 | - if (! @File::move($fileName, $newFile)) { |
|
| 1815 | + if (!@File::move($fileName, $newFile)) { |
|
| 1816 | 1816 | $copied = @File::copy($fileName, $newFile); |
| 1817 | 1817 | |
| 1818 | 1818 | // Delete the old file. |
| 1819 | 1819 | File::delete($fileName); |
| 1820 | 1820 | |
| 1821 | 1821 | // If it didn't copy, continue. |
| 1822 | - if (! $copied) { |
|
| 1822 | + if (!$copied) { |
|
| 1823 | 1823 | return false; |
| 1824 | 1824 | } |
| 1825 | 1825 | } |
@@ -1845,7 +1845,7 @@ discard block |
||
| 1845 | 1845 | */ |
| 1846 | 1846 | protected function _getMediaInfo($fileLocation): bool |
| 1847 | 1847 | { |
| 1848 | - if (! $this->_processMediaInfo) { |
|
| 1848 | + if (!$this->_processMediaInfo) { |
|
| 1849 | 1849 | return false; |
| 1850 | 1850 | } |
| 1851 | 1851 | |
@@ -1920,7 +1920,7 @@ discard block |
||
| 1920 | 1920 | $filesAdded = 0; |
| 1921 | 1921 | |
| 1922 | 1922 | foreach ($this->_par2Info->getFileList() as $file) { |
| 1923 | - if (! isset($file['name'])) { |
|
| 1923 | + if (!isset($file['name'])) { |
|
| 1924 | 1924 | continue; |
| 1925 | 1925 | } |
| 1926 | 1926 | |
@@ -1943,7 +1943,7 @@ discard block |
||
| 1943 | 1943 | } |
| 1944 | 1944 | |
| 1945 | 1945 | // Try to get a new name. |
| 1946 | - if (! $foundName) { |
|
| 1946 | + if (!$foundName) { |
|
| 1947 | 1947 | $this->_release->textstring = $file['name']; |
| 1948 | 1948 | $this->_release->releases_id = $this->_release->id; |
| 1949 | 1949 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | protected function _processVideoFile($fileLocation): void |
| 1974 | 1974 | { |
| 1975 | 1975 | // Try to get a sample with it. |
| 1976 | - if (! $this->_foundSample) { |
|
| 1976 | + if (!$this->_foundSample) { |
|
| 1977 | 1977 | $this->_foundSample = $this->_getSample($fileLocation); |
| 1978 | 1978 | } |
| 1979 | 1979 | |
@@ -1981,12 +1981,12 @@ discard block |
||
| 1981 | 1981 | * Don't get it here if _sampleMessageIDs is empty |
| 1982 | 1982 | * or has 1 message-id (Saves downloading another part). |
| 1983 | 1983 | */ |
| 1984 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 1984 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
| 1985 | 1985 | $this->_foundVideo = $this->_getVideo($fileLocation); |
| 1986 | 1986 | } |
| 1987 | 1987 | |
| 1988 | 1988 | // Try to get media info with it. |
| 1989 | - if (! $this->_foundMediaInfo) { |
|
| 1989 | + if (!$this->_foundMediaInfo) { |
|
| 1990 | 1990 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
| 1991 | 1991 | } |
| 1992 | 1992 | } |
@@ -2008,24 +2008,24 @@ discard block |
||
| 2008 | 2008 | $bf = true; |
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2011 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
| 2012 | 2012 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
| 2013 | 2013 | $af = true; |
| 2014 | 2014 | } |
| 2015 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2015 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
| 2016 | 2016 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
| 2017 | 2017 | $bf = true; |
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | - if (! $af && ! $bf) { |
|
| 2020 | + if (!$af && !$bf) { |
|
| 2021 | 2021 | return strnatcasecmp($a, $b); |
| 2022 | 2022 | } |
| 2023 | 2023 | |
| 2024 | - if (! $bf) { |
|
| 2024 | + if (!$bf) { |
|
| 2025 | 2025 | return -1; |
| 2026 | 2026 | } |
| 2027 | 2027 | |
| 2028 | - if (! $af) { |
|
| 2028 | + if (!$af) { |
|
| 2029 | 2029 | return 1; |
| 2030 | 2030 | } |
| 2031 | 2031 | |
@@ -2050,12 +2050,12 @@ discard block |
||
| 2050 | 2050 | protected function _resetReleaseStatus(): void |
| 2051 | 2051 | { |
| 2052 | 2052 | // Only process for samples, previews and images if not disabled. |
| 2053 | - $this->_foundVideo = ! $this->_processVideo; |
|
| 2054 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
| 2055 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
| 2056 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
| 2057 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
| 2058 | - $this->_foundSample = ! $this->_processThumbnails; |
|
| 2053 | + $this->_foundVideo = !$this->_processVideo; |
|
| 2054 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
| 2055 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
| 2056 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
| 2057 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
| 2058 | + $this->_foundSample = !$this->_processThumbnails; |
|
| 2059 | 2059 | $this->_foundPAR2Info = false; |
| 2060 | 2060 | |
| 2061 | 2061 | $this->_passwordStatus = Releases::PASSWD_NONE; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | protected function trailers(): mixed |
| 60 | 60 | { |
| 61 | 61 | $ret = $this->_html->find('a[itemprop=trailer]', 0); |
| 62 | - if (! empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) { |
|
| 62 | + if (!empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) { |
|
| 63 | 63 | $movieid = $hits['movieid']; |
| 64 | 64 | $this->_res['trailers']['url'] = self::AEBNSURL.self::TRAILERURL.$movieid; |
| 65 | 65 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $this->_res['genres'][] = trim($genre->plaintext); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - if (! empty($this->_res['genres'])) { |
|
| 98 | + if (!empty($this->_res['genres'])) { |
|
| 99 | 99 | $this->_res['genres'] = array_unique($this->_res['genres']); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | $this->_res = []; |
| 111 | 111 | $ret = $this->_html->findOne('div.starsFull'); |
| 112 | - if (! $ret instanceof SimpleHtmlDomNodeBlank) { |
|
| 112 | + if (!$ret instanceof SimpleHtmlDomNodeBlank) { |
|
| 113 | 113 | foreach ($ret->find('span[itemprop=name]') as $star) { |
| 114 | 114 | $this->_res['cast'][] = trim($star->plaintext); |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | $ret = $this->_html->findOne('div.detailsLink'); |
| 118 | - if (! $ret instanceof SimpleHtmlDomNodeBlank) { |
|
| 118 | + if (!$ret instanceof SimpleHtmlDomNodeBlank) { |
|
| 119 | 119 | foreach ($ret->find('span') as $star) { |
| 120 | 120 | if (str_contains($star->plaintext, '/More/') && str_contains($star->plaintext, '/Stars/')) { |
| 121 | 121 | $this->_res['cast'][] = trim($star->plaintext); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $videoDuration = $videoFormat = $videoCodec = $videoWidth = $videoHeight = $videoAspect = $videoFrameRate = $videoLibrary = $videoBitRate = ''; |
| 91 | 91 | |
| 92 | - if (! empty($videos)) { |
|
| 92 | + if (!empty($videos)) { |
|
| 93 | 93 | foreach ($videos as $video) { |
| 94 | 94 | if ($video->get('duration') !== null) { |
| 95 | 95 | $videoDuration = $video->get('duration')->getMilliseconds(); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $videoBitRate = $video->get('nominal_bit_rate')->getTextValue(); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if (! empty($videoBitRate)) { |
|
| 142 | + if (!empty($videoBitRate)) { |
|
| 143 | 143 | $overallBitRate = $videoBitRate; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $audioID = 1; |
| 151 | 151 | $audioFormat = $audioMode = $audioBitRateMode = $audioBitRate = $audioChannels = $audioSampleRate = $audioLibrary = $audioLanguage = $audioTitle = ''; |
| 152 | 152 | |
| 153 | - if (! empty($audios)) { |
|
| 153 | + if (!empty($audios)) { |
|
| 154 | 154 | foreach ($audios as $audio) { |
| 155 | 155 | if ($audio->get('id') !== null) { |
| 156 | 156 | $audioID = $audio->get('id')->getFullName(); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if (! empty($subtitles)) { |
|
| 199 | + if (!empty($subtitles)) { |
|
| 200 | 200 | foreach ($subtitles as $subtitle) { |
| 201 | 201 | $subsID = 1; |
| 202 | 202 | $subsLanguage = 'Unknown'; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | 'audiochannels' => \is_array($audioChannels) ? implode($audioChannels) : $audioChannels, |
| 261 | 261 | 'audiosamplerate' => \is_array($audioSampleRate) ? implode($audioSampleRate) : $audioSampleRate, |
| 262 | 262 | 'audiolibrary' => \is_array($audioLibrary) ? implode($audioLibrary) : $audioLibrary, |
| 263 | - 'audiolanguage' => ! empty($audioLanguage) ? $audioLanguage[1] : '', |
|
| 263 | + 'audiolanguage' => !empty($audioLanguage) ? $audioLanguage[1] : '', |
|
| 264 | 264 | 'audiotitle' => \is_array($audioTitle) ? implode($audioTitle) : $audioTitle, |
| 265 | 265 | ]); |
| 266 | 266 | } |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | $ckid = ReleaseSubtitle::query()->where('releases_id', $releaseID)->where('subsid', '=', $subsID)->first(['releases_id']); |
| 272 | 272 | $subs = ''; |
| 273 | - if (! empty($subsLanguage)) { |
|
| 274 | - if (! empty($subsLanguage[1])) { |
|
| 273 | + if (!empty($subsLanguage)) { |
|
| 274 | + if (!empty($subsLanguage[1])) { |
|
| 275 | 275 | $subs = $subsLanguage[1]; |
| 276 | - } elseif (! empty($subsLanguage[0])) { |
|
| 276 | + } elseif (!empty($subsLanguage[0])) { |
|
| 277 | 277 | $subs = $subsLanguage[0]; |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | $release = (object) $release; |
| 811 | 811 | } |
| 812 | 812 | // If $release does not have a releases_id, we should add it. |
| 813 | - if (! isset($release->releases_id)) { |
|
| 813 | + if (!isset($release->releases_id)) { |
|
| 814 | 814 | $release->releases_id = $release->id; |
| 815 | 815 | } |
| 816 | 816 | if ($this->relid !== $release->releases_id) { |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | $this->matched = true; |
| 820 | 820 | $this->relid = (int) $release->releases_id; |
| 821 | 821 | |
| 822 | - $determinedCategory = $this->category->determineCategory($release->groups_id, $newName, ! empty($release->fromname) ? $release->fromname : ''); |
|
| 822 | + $determinedCategory = $this->category->determineCategory($release->groups_id, $newName, !empty($release->fromname) ? $release->fromname : ''); |
|
| 823 | 823 | |
| 824 | 824 | if ($type === 'PAR2, ') { |
| 825 | 825 | $newName = ucwords($newName); |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | $this->colorCLI->info($type.$method). |
| 861 | 861 | $this->colorCLI->headerOver('Releases ID: '). |
| 862 | 862 | $this->colorCLI->info($release->releases_id); |
| 863 | - if (! empty($release->filename)) { |
|
| 863 | + if (!empty($release->filename)) { |
|
| 864 | 864 | $this->colorCLI->headerOver('Filename: '). |
| 865 | 865 | $this->colorCLI->info($release->filename); |
| 866 | 866 | } |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | |
| 1059 | 1059 | if (\strlen($preTitle) >= 15 && preg_match(self::PREDB_REGEX, $preTitle)) { |
| 1060 | 1060 | $titleMatch = $this->manticore->searchIndexes('releases_rt', $preTitle, ['name', 'searchname', 'filename']); |
| 1061 | - if (! empty($titleMatch)) { |
|
| 1061 | + if (!empty($titleMatch)) { |
|
| 1062 | 1062 | $join = implode(',', Arr::get($titleMatch, 'id')); |
| 1063 | 1063 | } |
| 1064 | 1064 | } |
@@ -1155,9 +1155,9 @@ discard block |
||
| 1155 | 1155 | } else { |
| 1156 | 1156 | $results = Arr::get($this->manticore->searchIndexes('predb_rt', $preMatch[1], ['filename', 'title']), 'data'); |
| 1157 | 1157 | } |
| 1158 | - if (! empty($results)) { |
|
| 1158 | + if (!empty($results)) { |
|
| 1159 | 1159 | foreach ($results as $result) { |
| 1160 | - if (! empty($result)) { |
|
| 1160 | + if (!empty($result)) { |
|
| 1161 | 1161 | $preFtMatch = $this->preMatch($result['filename']); |
| 1162 | 1162 | if ($preFtMatch[0] === true) { |
| 1163 | 1163 | $this->_fileName = $result['filename']; |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | // first strip all non-printing chars from filename |
| 1188 | 1188 | $this->_fileName = str_replace('/[[:^print:]]/', '', $this->_fileName); |
| 1189 | 1189 | |
| 1190 | - if ($this->_fileName !== '' && ! str_starts_with($this->_fileName, '.')) { |
|
| 1190 | + if ($this->_fileName !== '' && !str_starts_with($this->_fileName, '.')) { |
|
| 1191 | 1191 | $this->_fileName = match (true) { |
| 1192 | 1192 | str_contains($this->_fileName, '.') => Str::beforeLast('.', $this->_fileName), |
| 1193 | 1193 | preg_match('/\.part\d+$/', $this->_fileName) => Str::beforeLast('.', $this->_fileName), |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | ); |
| 1234 | 1234 | |
| 1235 | 1235 | foreach ($row as $item) { |
| 1236 | - if (! empty($item)) { |
|
| 1236 | + if (!empty($item)) { |
|
| 1237 | 1237 | if ($item->title !== $release->searchname) { |
| 1238 | 1238 | $this->updateRelease($release, $item->title, 'predb hash release name: '.$item->source, $echo, $hashtype, $nameStatus, $show, $item->predb_id); |
| 1239 | 1239 | $matching++; |
@@ -1318,7 +1318,7 @@ discard block |
||
| 1318 | 1318 | { |
| 1319 | 1319 | |
| 1320 | 1320 | // Get pre style name from releases.name |
| 1321 | - if (preg_match_all(self::PREDB_REGEX, $release->textstring, $hits) && ! preg_match('/Source\s\:/i', $release->textstring)) { |
|
| 1321 | + if (preg_match_all(self::PREDB_REGEX, $release->textstring, $hits) && !preg_match('/Source\s\:/i', $release->textstring)) { |
|
| 1322 | 1322 | foreach ($hits as $hit) { |
| 1323 | 1323 | foreach ($hit as $val) { |
| 1324 | 1324 | $title = Predb::query()->where('title', trim($val))->select(['title', 'id'])->first(); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | // if only processing for PreDB match skip to return |
| 1334 | - if (! $preId) { |
|
| 1334 | + if (!$preId) { |
|
| 1335 | 1335 | switch ($type) { |
| 1336 | 1336 | case 'PAR2, ': |
| 1337 | 1337 | $this->fileCheck($release, $echo, $type, $nameStatus, $show); |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | 1373 | // set NameFixer process flags after run |
| 1374 | - if ($nameStatus === true && ! $this->matched) { |
|
| 1374 | + if ($nameStatus === true && !$this->matched) { |
|
| 1375 | 1375 | switch ($type) { |
| 1376 | 1376 | case 'NFO, ': |
| 1377 | 1377 | $this->_updateSingleColumn('proc_nfo', self::PROC_NFO_DONE, $release->releases_id); |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | |
| 1422 | 1422 | $result = []; |
| 1423 | 1423 | |
| 1424 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1424 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1425 | 1425 | if (preg_match('/\w[\-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|(?<!\d)[S|]\d{1,2}[E|x]\d{1,}(?!\d)|ep[._ -]?\d{2})[\-\w.\',;.()]+(BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -][\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
| 1426 | 1426 | $this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.Text.source.group', $echo, $type, $nameStatus, $show); |
| 1427 | 1427 | } elseif (preg_match('/\w[\-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[\-\w.\',;& ]+((19|20)\d\d)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | |
| 1452 | 1452 | $result = []; |
| 1453 | 1453 | |
| 1454 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1454 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1455 | 1455 | if (preg_match('/\w[\-\w.\',;& ]+((19|20)\d\d)[\-\w.\',;& ]+(480|720|1080)[ip][._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
| 1456 | 1456 | $this->updateRelease($release, $result['0'], 'movieCheck: Title.year.Text.res.vcod.group', $echo, $type, $nameStatus, $show); |
| 1457 | 1457 | } elseif (preg_match('/\w[\-\w.\',;& ]+((19|20)\d\d)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[._ -](480|720|1080)[ip][\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
@@ -1493,7 +1493,7 @@ discard block |
||
| 1493 | 1493 | |
| 1494 | 1494 | $result = []; |
| 1495 | 1495 | |
| 1496 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1496 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1497 | 1497 | if (preg_match('/\w[\-\w.\',;& ]+(ASIA|DLC|EUR|GOTY|JPN|KOR|MULTI\d{1}|NTSCU?|PAL|RF|Region[._ -]?Free|USA|XBLA)[._ -](DLC[._ -]Complete|FRENCH|GERMAN|MULTI\d{1}|PROPER|PSN|READ[._ -]?NFO|UMD)?[._ -]?(GC|NDS|NGC|PS3|PSP|WII|XBOX(360)?)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
| 1498 | 1498 | $this->updateRelease($release, $result['0'], 'gameCheck: Videogames 1', $echo, $type, $nameStatus, $show); |
| 1499 | 1499 | } elseif (preg_match('/\w[\-\w.\',;& ]+(GC|NDS|NGC|PS3|WII|XBOX(360)?)[._ -](DUPLEX|iNSOMNi|OneUp|STRANGE|SWAG|SKY)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | |
| 1520 | 1520 | $result = []; |
| 1521 | 1521 | |
| 1522 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1522 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1523 | 1523 | if (preg_match('/\w[\-\w.\',;& ]+(\d{1,10}|Linux|UNIX)[._ -](RPM)?[._ -]?(X64)?[._ -]?(Incl)[._ -](Keygen)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
| 1524 | 1524 | $this->updateRelease($release, $result['0'], 'appCheck: Apps 1', $echo, $type, $nameStatus, $show); |
| 1525 | 1525 | } elseif (preg_match('/\w[\-\w.\',;& ]+\d{1,8}[._ -](winall-freeware)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | $result = []; |
| 1541 | 1541 | |
| 1542 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1542 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1543 | 1543 | if (preg_match('/:\s*.*[\\\\\/]([A-Z0-9].+?S\d+[.-_ ]?[ED]\d+.+?)\.\w{2,}\s+/i', $release->textstring, $result)) { |
| 1544 | 1544 | $this->updateRelease($release, $result['1'], 'nfoCheck: Generic TV 1', $echo, $type, $nameStatus, $show); |
| 1545 | 1545 | } elseif (preg_match('/(?:(\:\s{1,}))(.+?S\d{1,3}[.-_ ]?[ED]\d{1,3}.+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | |
| 1560 | 1560 | $result = []; |
| 1561 | 1561 | |
| 1562 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1562 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1563 | 1563 | if (preg_match('/(?:((?!Source\s)\:\s{1,}))(.+?(19|20)\d\d.+?(BDRip|bluray|DVD(R|Rip)?|XVID).+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
| 1564 | 1564 | $this->updateRelease($release, $result['2'], 'nfoCheck: Generic Movies 1', $echo, $type, $nameStatus, $show); |
| 1565 | 1565 | } elseif (preg_match('/(?:(\s{2,}))((?!Source).+?[\.\-_ ](19|20)\d\d.+?(BDRip|bluray|DVD(R|Rip)?|XVID).+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | |
| 1579 | 1579 | $result = []; |
| 1580 | 1580 | |
| 1581 | - if (! $this->done && $this->relid !== (int) $release->releases_id && preg_match('/(?:\s{2,})(.+?-FM-\d{2}-\d{2})/i', $release->textstring, $result)) { |
|
| 1581 | + if (!$this->done && $this->relid !== (int) $release->releases_id && preg_match('/(?:\s{2,})(.+?-FM-\d{2}-\d{2})/i', $release->textstring, $result)) { |
|
| 1582 | 1582 | $newName = str_replace('-FM-', '-FM-Radio-MP3-', $result['1']); |
| 1583 | 1583 | $this->updateRelease($release, $newName, 'nfoCheck: Music FM RADIO', $echo, $type, $nameStatus, $show); |
| 1584 | 1584 | } |
@@ -1595,7 +1595,7 @@ discard block |
||
| 1595 | 1595 | |
| 1596 | 1596 | $result = []; |
| 1597 | 1597 | |
| 1598 | - if (! $this->done && $this->relid !== (int) $release->releases_id && preg_match('/(\w[\-\w`~!@#$%^&*()_+={}|"<>?\[\]\\;\',.\/ ]+\s?\((19|20)\d\d\))/i', $release->textstring, $result) && ! preg_match('/\.pdf|Audio ?Book/i', $release->textstring)) { |
|
| 1598 | + if (!$this->done && $this->relid !== (int) $release->releases_id && preg_match('/(\w[\-\w`~!@#$%^&*()_+={}|"<>?\[\]\\;\',.\/ ]+\s?\((19|20)\d\d\))/i', $release->textstring, $result) && !preg_match('/\.pdf|Audio ?Book/i', $release->textstring)) { |
|
| 1599 | 1599 | $releaseName = $result[0]; |
| 1600 | 1600 | if (preg_match('/(idiomas|lang|language|langue|sprache).*?\b(?P<lang>Brazilian|Chinese|Croatian|Danish|DE|Deutsch|Dutch|Estonian|ES|English|Englisch|Finnish|Flemish|Francais|French|FR|German|Greek|Hebrew|Icelandic|Italian|Japenese|Japan|Japanese|Korean|Latin|Nordic|Norwegian|Polish|Portuguese|Russian|Serbian|Slovenian|Swedish|Spanisch|Spanish|Thai|Turkish)\b/i', $release->textstring, $result)) { |
| 1601 | 1601 | switch ($result['lang']) { |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | |
| 1769 | 1769 | $result = []; |
| 1770 | 1770 | |
| 1771 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1771 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1772 | 1772 | if (preg_match('/ALiAS|BAT-TEAM|FAiRLiGHT|Game Type|Glamoury|HI2U|iTWINS|JAGUAR|(LARGE|MEDIUM)ISO|MAZE|nERv|PROPHET|PROFiT|PROCYON|RELOADED|REVOLVER|ROGUE|ViTALiTY/i', $release->textstring)) { |
| 1773 | 1773 | if (preg_match('/\w[\w.+&*\/\()\',;: -]+\(c\)[\-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
| 1774 | 1774 | $releaseName = str_replace(['(c)', '(C)'], '(GAMES) (c)', $result['0']); |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | public function nfoCheckMisc($release, bool $echo, string $type, $nameStatus, $show): void |
| 1793 | 1793 | { |
| 1794 | 1794 | |
| 1795 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1795 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1796 | 1796 | if (preg_match('/Supplier.+?IGUANA/i', $release->textstring)) { |
| 1797 | 1797 | $releaseName = ''; |
| 1798 | 1798 | $result = []; |
@@ -1831,7 +1831,7 @@ discard block |
||
| 1831 | 1831 | |
| 1832 | 1832 | $result = []; |
| 1833 | 1833 | |
| 1834 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1834 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1835 | 1835 | switch (true) { |
| 1836 | 1836 | case preg_match('/^(.+?(x264|XviD)\-TVP)\\\\/i', $release->textstring, $result): |
| 1837 | 1837 | $this->updateRelease($release, $result['1'], 'fileCheck: TVP', $echo, $type, $nameStatus, $show); |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | public function uidCheck($release, $echo, $type, $nameStatus, $show): bool |
| 1924 | 1924 | { |
| 1925 | 1925 | |
| 1926 | - if (! empty($release->uid) && ! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1926 | + if (!empty($release->uid) && !$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1927 | 1927 | $result = Release::fromQuery(sprintf( |
| 1928 | 1928 | ' |
| 1929 | 1929 | SELECT r.id AS releases_id, r.size AS relsize, r.name AS textstring, r.searchname, r.fromname, r.predb_id |
@@ -1972,8 +1972,8 @@ discard block |
||
| 1972 | 1972 | { |
| 1973 | 1973 | |
| 1974 | 1974 | $newName = ''; |
| 1975 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1976 | - if (! empty($release->movie_name)) { |
|
| 1975 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 1976 | + if (!empty($release->movie_name)) { |
|
| 1977 | 1977 | if (preg_match(self::PREDB_REGEX, $release->movie_name, $hit)) { |
| 1978 | 1978 | $newName = $hit[1]; |
| 1979 | 1979 | } elseif (preg_match('/(.+),(\sRMZ\.cr)?$/i', $release->movie_name, $hit)) { |
@@ -2004,7 +2004,7 @@ discard block |
||
| 2004 | 2004 | public function xxxNameCheck($release, $echo, $type, $nameStatus, $show): bool |
| 2005 | 2005 | { |
| 2006 | 2006 | |
| 2007 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2007 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2008 | 2008 | $result = Release::fromQuery( |
| 2009 | 2009 | sprintf( |
| 2010 | 2010 | " |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | public function srrNameCheck($release, $echo, $type, $nameStatus, $show): bool |
| 2053 | 2053 | { |
| 2054 | 2054 | |
| 2055 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2055 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2056 | 2056 | $result = Release::fromQuery( |
| 2057 | 2057 | sprintf( |
| 2058 | 2058 | " |
@@ -2100,7 +2100,7 @@ discard block |
||
| 2100 | 2100 | public function hashCheck($release, $echo, $type, $nameStatus, $show): bool |
| 2101 | 2101 | { |
| 2102 | 2102 | |
| 2103 | - if (! $this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2103 | + if (!$this->done && $this->relid !== (int) $release->releases_id) { |
|
| 2104 | 2104 | $result = Release::fromQuery(sprintf( |
| 2105 | 2105 | ' |
| 2106 | 2106 | SELECT r.id AS releases_id, r.size AS relsize, r.name AS textstring, r.searchname, r.fromname, r.predb_id |
@@ -2146,7 +2146,7 @@ discard block |
||
| 2146 | 2146 | public function crcCheck($release, $echo, $type, $nameStatus, $show): bool |
| 2147 | 2147 | { |
| 2148 | 2148 | |
| 2149 | - if (! $this->done && $this->relid !== (int) $release->releases_id && $release->textstring !== '') { |
|
| 2149 | + if (!$this->done && $this->relid !== (int) $release->releases_id && $release->textstring !== '') { |
|
| 2150 | 2150 | $result = Release::fromQuery( |
| 2151 | 2151 | sprintf( |
| 2152 | 2152 | ' |
@@ -2207,11 +2207,11 @@ discard block |
||
| 2207 | 2207 | $this->_fileName = $release->textstring; |
| 2208 | 2208 | $this->_cleanMatchFiles(); |
| 2209 | 2209 | $this->cleanFileNames(); |
| 2210 | - if (! empty($this->_fileName)) { |
|
| 2210 | + if (!empty($this->_fileName)) { |
|
| 2211 | 2211 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 2212 | 2212 | $results = $this->elasticsearch->searchPreDb($this->_fileName); |
| 2213 | 2213 | foreach ($results as $hit) { |
| 2214 | - if (! empty($hit)) { |
|
| 2214 | + if (!empty($hit)) { |
|
| 2215 | 2215 | $this->updateRelease($release, $hit['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $hit['id']); |
| 2216 | 2216 | |
| 2217 | 2217 | return true; |
@@ -2219,9 +2219,9 @@ discard block |
||
| 2219 | 2219 | } |
| 2220 | 2220 | } else { |
| 2221 | 2221 | $predbSearch = Arr::get($this->manticore->searchIndexes('predb_rt', $this->_fileName, ['filename', 'title']), 'data'); |
| 2222 | - if (! empty($predbSearch)) { |
|
| 2222 | + if (!empty($predbSearch)) { |
|
| 2223 | 2223 | foreach ($predbSearch as $hit) { |
| 2224 | - if (! empty($hit)) { |
|
| 2224 | + if (!empty($hit)) { |
|
| 2225 | 2225 | $this->updateRelease($release, $hit['title'], 'PreDb: Filename match', $echo, $type, $nameStatus, $show); |
| 2226 | 2226 | |
| 2227 | 2227 | return true; |
@@ -2243,11 +2243,11 @@ discard block |
||
| 2243 | 2243 | $this->_fileName = $release->textstring; |
| 2244 | 2244 | $this->_cleanMatchFiles(); |
| 2245 | 2245 | $this->cleanFileNames(); |
| 2246 | - if (! empty($this->_fileName)) { |
|
| 2246 | + if (!empty($this->_fileName)) { |
|
| 2247 | 2247 | if (config('nntmux.elasticsearch_enabled') === true) { |
| 2248 | 2248 | $results = $this->elasticsearch->searchPreDb($this->_fileName); |
| 2249 | 2249 | foreach ($results as $hit) { |
| 2250 | - if (! empty($hit)) { |
|
| 2250 | + if (!empty($hit)) { |
|
| 2251 | 2251 | $this->updateRelease($release, $hit['title'], 'PreDb: Title match', $echo, $type, $nameStatus, $show, $hit['id']); |
| 2252 | 2252 | |
| 2253 | 2253 | return true; |
@@ -2255,9 +2255,9 @@ discard block |
||
| 2255 | 2255 | } |
| 2256 | 2256 | } else { |
| 2257 | 2257 | $results = Arr::get($this->manticore->searchIndexes('predb_rt', $this->_fileName, ['title']), 'data'); |
| 2258 | - if (! empty($results)) { |
|
| 2258 | + if (!empty($results)) { |
|
| 2259 | 2259 | foreach ($results as $hit) { |
| 2260 | - if (! empty($hit)) { |
|
| 2260 | + if (!empty($hit)) { |
|
| 2261 | 2261 | $this->updateRelease($release, $hit['title'], 'PreDb: Title match', $echo, $type, $nameStatus, $show); |
| 2262 | 2262 | |
| 2263 | 2263 | return true; |
@@ -2273,10 +2273,10 @@ discard block |
||
| 2273 | 2273 | private function cleanFileNames(): array|string|null |
| 2274 | 2274 | { |
| 2275 | 2275 | if (preg_match('/(\.[a-zA-Z]{2})?(\.4k|\.fullhd|\.hd|\.int|\.\d+)?$/i', $this->_fileName, $hit)) { |
| 2276 | - if (! empty($hit[1]) && preg_match('/\.[a-zA-Z]{2}/i', $hit[1])) { |
|
| 2276 | + if (!empty($hit[1]) && preg_match('/\.[a-zA-Z]{2}/i', $hit[1])) { |
|
| 2277 | 2277 | $this->_fileName = preg_replace('/\.[a-zA-Z]{2}\./i', '.', $this->_fileName); |
| 2278 | 2278 | } |
| 2279 | - if (! empty($hit[2])) { |
|
| 2279 | + if (!empty($hit[2])) { |
|
| 2280 | 2280 | if (preg_match('/\.4k$/', $hit[2])) { |
| 2281 | 2281 | $this->_fileName = preg_replace('/\.4k$/', '.2160p', $this->_fileName); |
| 2282 | 2282 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public static function addData($id, MediaInfoContainer $xmlArray): void |
| 16 | 16 | { |
| 17 | 17 | $mediainfoArray = $xmlArray->getGeneral(); |
| 18 | - if (! $mediainfoArray) { |
|
| 18 | + if (!$mediainfoArray) { |
|
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -85,20 +85,20 @@ discard block |
||
| 85 | 85 | Route::post('login', [LoginController::class, 'login'])->name('login'); |
| 86 | 86 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); |
| 87 | 87 | |
| 88 | -Route::middleware('isVerified')->group(function () { |
|
| 88 | +Route::middleware('isVerified')->group(function() { |
|
| 89 | 89 | Route::get('resetpassword', [ResetPasswordController::class, 'reset']); |
| 90 | 90 | Route::post('resetpassword', [ResetPasswordController::class, 'reset']); |
| 91 | 91 | |
| 92 | 92 | Route::get('profile', [ProfileController::class, 'show']); |
| 93 | 93 | |
| 94 | - Route::prefix('browse')->group(function () { |
|
| 94 | + Route::prefix('browse')->group(function() { |
|
| 95 | 95 | Route::get('tags', [BrowseController::class, 'tags']); |
| 96 | 96 | Route::get('group', [BrowseController::class, 'group']); |
| 97 | 97 | Route::get('All', [BrowseController::class, 'index']); |
| 98 | 98 | Route::get('{parentCategory}/{id?}', [BrowseController::class, 'show'])->middleware('clearance'); |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | - Route::prefix('cart')->group(function () { |
|
| 101 | + Route::prefix('cart')->group(function() { |
|
| 102 | 102 | Route::get('index', [CartController::class, 'index']); |
| 103 | 103 | Route::post('index', [CartController::class, 'index']); |
| 104 | 104 | Route::get('add', [CartController::class, 'store']); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | Route::post('failed', [FailedReleasesController::class, 'failed'])->name('failed'); |
| 133 | 133 | |
| 134 | - Route::middleware('clearance')->group(function () { |
|
| 134 | + Route::middleware('clearance')->group(function() { |
|
| 135 | 135 | Route::get('Games', [GamesController::class, 'show'])->name('Games'); |
| 136 | 136 | Route::post('Games', [GamesController::class, 'show'])->name('Games'); |
| 137 | 137 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | Route::post('disable2fa', [PasswordSecurityController::class, 'disable2fa'])->name('disable2fa'); |
| 227 | 227 | }); |
| 228 | 228 | |
| 229 | -Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function () { |
|
| 229 | +Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function() { |
|
| 230 | 230 | Route::get('index', [AdminPageController::class, 'index']); |
| 231 | 231 | Route::get('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']); |
| 232 | 232 | Route::post('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']); |
@@ -345,12 +345,12 @@ discard block |
||
| 345 | 345 | Route::post('group-list-inactive', [AdminGroupController::class, 'inactive']); |
| 346 | 346 | }); |
| 347 | 347 | |
| 348 | -Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function () { |
|
| 348 | +Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function() { |
|
| 349 | 349 | Route::get('release-edit', [AdminReleasesController::class, 'edit']); |
| 350 | 350 | Route::post('release-edit', [AdminReleasesController::class, 'edit']); |
| 351 | 351 | }); |
| 352 | 352 | |
| 353 | -Route::post('2faVerify', function () { |
|
| 353 | +Route::post('2faVerify', function() { |
|
| 354 | 354 | return redirect()->to(URL()->previous()); |
| 355 | 355 | })->name('2faVerify')->middleware('2fa'); |
| 356 | 356 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $colorCli = new ColorCLI(); |
| 12 | 12 | |
| 13 | -if (! (isset($argv[1]) && ($argv[1] === 'all' || $argv[1] === 'misc' || preg_match('/\([\d, ]+\)/', $argv[1]) || is_numeric($argv[1])))) { |
|
| 13 | +if (!(isset($argv[1]) && ($argv[1] === 'all' || $argv[1] === 'misc' || preg_match('/\([\d, ]+\)/', $argv[1]) || is_numeric($argv[1])))) { |
|
| 14 | 14 | $colorCli->error( |
| 15 | 15 | "\nThis script will attempt to re-categorize releases and is useful if changes have been made to Category.php.\n" |
| 16 | 16 | ."No updates will be done unless the category changes\n" |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $timeStart = now(); |
| 41 | 41 | $chgCount = categorizeRelease($argv, true); |
| 42 | 42 | $time = now()->diffInSeconds($timeStart, true); |
| 43 | - if (! isset($argv[2])) { |
|
| 43 | + if (!isset($argv[2])) { |
|
| 44 | 44 | $colorCli->header('Finished re-categorizing '.number_format($chgCount).' releases in '.$time.' seconds, using the searchname.').PHP_EOL; |
| 45 | 45 | } else { |
| 46 | 46 | $colorCli->header('Finished re-categorizing in '.$time.' seconds , using the searchname.'.PHP_EOL |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $consoleTools = new ConsoleTools(); |
| 69 | 69 | $relCount = $chgCount = 0; |
| 70 | 70 | if ($total > 0) { |
| 71 | - $query->chunk('100', function ($results) use ($update, $relCount, $chgCount) { |
|
| 71 | + $query->chunk('100', function($results) use ($update, $relCount, $chgCount) { |
|
| 72 | 72 | $cat = new Categorize(); |
| 73 | 73 | foreach ($results as $result) { |
| 74 | 74 | $catId = $cat->determineCategory($result->groups_id, $result->searchname, $result->fromname); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function handle(): void |
| 38 | 38 | { |
| 39 | 39 | // Check if any options are false |
| 40 | - if (! $this->option('notindb') && ! $this->option('notondisk')) { |
|
| 40 | + if (!$this->option('notindb') && !$this->option('notondisk')) { |
|
| 41 | 41 | $this->error('You must specify at least one option. See: --help'); |
| 42 | 42 | exit(); |
| 43 | 43 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $guid = stristr($filePath->getFilename(), '.nzb.gz', true); |
| 64 | 64 | if (File::isFile($filePath) && $guid) { |
| 65 | 65 | // If NZB file guid is not present in DB delete the file from disk |
| 66 | - if (! $releases->whereGuid($guid)->exists()) { |
|
| 66 | + if (!$releases->whereGuid($guid)->exists()) { |
|
| 67 | 67 | if ($delete) { |
| 68 | 68 | File::delete($filePath); |
| 69 | 69 | } |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | $total = Release::count(); |
| 89 | 89 | $this->alert("Total releases to check: $total"); |
| 90 | 90 | |
| 91 | - Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function (Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
| 91 | + Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function(Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) { |
|
| 92 | 92 | echo 'Total done: '.$checked."\r"; |
| 93 | 93 | foreach ($releases as $r) { |
| 94 | 94 | |
| 95 | - if (! $nzb->NZBPath($r->guid)) { |
|
| 95 | + if (!$nzb->NZBPath($r->guid)) { |
|
| 96 | 96 | if ($delete) { |
| 97 | 97 | $rel->deleteSingle(['g' => $r->guid, 'i' => $r->id], $nzb, new ReleaseImage()); |
| 98 | 98 | } |