@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | $browseBy = ' '; |
277 | 277 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
278 | - if (! empty($_REQUEST[$bbk])) { |
|
278 | + if (!empty($_REQUEST[$bbk])) { |
|
279 | 279 | $bbs = stripslashes($_REQUEST[$bbk]); |
280 | 280 | $browseBy .= ' AND con.'.$bbv.' LIKE '.escapeString('%'.$bbs.'%'); |
281 | 281 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $con['esrb'] = (string) $amaz->ItemAttributes->ESRBAgeRating; |
401 | 401 | $con['releasedate'] = (string) $amaz->ItemAttributes->ReleaseDate; |
402 | 402 | |
403 | - if (! isset($con['releasedate'])) { |
|
403 | + if (!isset($con['releasedate'])) { |
|
404 | 404 | $con['releasedate'] = ''; |
405 | 405 | } |
406 | 406 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | if (config('config.credentials.client_id') !== '' && config('config.credentials.client_secret') !== '') { |
629 | 629 | try { |
630 | 630 | $result = Game::where('name', $gameInfo)->get(); |
631 | - if (! empty($result)) { |
|
631 | + if (!empty($result)) { |
|
632 | 632 | $bestMatchPct = 0; |
633 | 633 | foreach ($result as $res) { |
634 | 634 | similar_text(strtolower($gameInfo), strtolower($res->name), $percent); |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | ])->where('id', $bestMatch)->first(); |
647 | 647 | |
648 | 648 | $publishers = []; |
649 | - if (! empty($game->involved_companies)) { |
|
649 | + if (!empty($game->involved_companies)) { |
|
650 | 650 | foreach ($game->involved_companies as $publisher) { |
651 | 651 | if ($publisher['publisher'] === true) { |
652 | 652 | $company = Company::find($publisher['company']); |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | |
658 | 658 | $genres = []; |
659 | 659 | |
660 | - if (! empty($game->themes)) { |
|
660 | + if (!empty($game->themes)) { |
|
661 | 661 | foreach ($game->themes as $theme) { |
662 | 662 | $genres[] = $theme['name']; |
663 | 663 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | $platform = ''; |
669 | 669 | |
670 | - if (! empty($game->platforms)) { |
|
670 | + if (!empty($game->platforms)) { |
|
671 | 671 | foreach ($game->platforms as $platforms) { |
672 | 672 | $percentCurrent = 0; |
673 | 673 | $gamePlatforms = Platform::where('id', $platforms)->get(); |
@@ -686,13 +686,13 @@ discard block |
||
686 | 686 | 'title' => $game->name, |
687 | 687 | 'asin' => $game->id, |
688 | 688 | 'review' => $game->summary ?? '', |
689 | - 'coverurl' => ! empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
690 | - 'releasedate' => ! empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
691 | - 'esrb' => ! empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
689 | + 'coverurl' => !empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
690 | + 'releasedate' => !empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
691 | + 'esrb' => !empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
692 | 692 | 'url' => $game->url ?? '', |
693 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
693 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
694 | 694 | 'platform' => $platform ?? '', |
695 | - 'consolegenre' => ! empty($genres) ? implode(',', $genres) : 'Unknown', |
|
695 | + 'consolegenre' => !empty($genres) ? implode(',', $genres) : 'Unknown', |
|
696 | 696 | 'consolegenreid' => $genreKey ?? '', |
697 | 697 | 'salesrank' => '', |
698 | 698 | ]; |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | $platform = 'PSX'; |
836 | 836 | } |
837 | 837 | |
838 | - if (! empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
838 | + if (!empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
839 | 839 | $platform = 'XBOX360'; |
840 | 840 | } |
841 | 841 | |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | Other option is to pass the $release->categories_id here if we don't find a platform but that |
851 | 851 | would require an extra lookup to determine the name. In either case we should have a title at the minimum. */ |
852 | 852 | |
853 | - return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; |
|
853 | + return (isset($result['title'], $result['platform']) && !empty($result['title'])) ? $result : false; |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | public function getBrowseNode($platform): string |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | $audios = $arrXml->getAudios(); |
107 | 107 | $videos = $arrXml->getVideos(); |
108 | 108 | $subtitles = $arrXml->getSubtitles(); |
109 | - if (! empty($general)) { |
|
110 | - if (! empty($general->get('unique_id')) && (int) $general->get('unique_id')->getShortName() !== 1) { |
|
109 | + if (!empty($general)) { |
|
110 | + if (!empty($general->get('unique_id')) && (int) $general->get('unique_id')->getShortName() !== 1) { |
|
111 | 111 | $uniqueId = $general->get('unique_id')->getShortName(); |
112 | 112 | $this->addUID($releaseID, $uniqueId); |
113 | 113 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $videoDuration = $videoFormat = $videoCodec = $videoWidth = $videoHeight = $videoAspect = $videoFrameRate = $videoLibrary = $videoBitRate = ''; |
124 | 124 | |
125 | - if (! empty($videos)) { |
|
125 | + if (!empty($videos)) { |
|
126 | 126 | foreach ($videos as $video) { |
127 | 127 | if ($video->get('duration') !== null) { |
128 | 128 | $videoDuration = $video->get('duration')->getMilliseconds(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $videoBitRate = $video->get('nominal_bit_rate')->getTextValue(); |
169 | 169 | } |
170 | 170 | |
171 | - if (! empty($videoBitRate)) { |
|
171 | + if (!empty($videoBitRate)) { |
|
172 | 172 | $overallBitRate = $videoBitRate; |
173 | 173 | } |
174 | 174 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $audioID = 1; |
180 | 180 | $audioFormat = $audioMode = $audioBitRateMode = $audioBitRate = $audioChannels = $audioSampleRate = $audioLibrary = $audioLanguage = $audioTitle = ''; |
181 | 181 | |
182 | - if (! empty($audios)) { |
|
182 | + if (!empty($audios)) { |
|
183 | 183 | foreach ($audios as $audio) { |
184 | 184 | if ($audio->get('id') !== null) { |
185 | 185 | $audioID = $audio->get('id')->getFullName(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - if (! empty($subtitles)) { |
|
228 | + if (!empty($subtitles)) { |
|
229 | 229 | foreach ($subtitles as $subtitle) { |
230 | 230 | $subsID = 1; |
231 | 231 | $subsLanguage = 'Unknown'; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | 'audiochannels' => \is_array($audioChannels) ? implode($audioChannels) : $audioChannels, |
290 | 290 | 'audiosamplerate' => \is_array($audioSampleRate) ? implode($audioSampleRate) : $audioSampleRate, |
291 | 291 | 'audiolibrary' => \is_array($audioLibrary) ? implode($audioLibrary) : $audioLibrary, |
292 | - 'audiolanguage' => ! empty($audioLanguage) ? $audioLanguage[1] : '', |
|
292 | + 'audiolanguage' => !empty($audioLanguage) ? $audioLanguage[1] : '', |
|
293 | 293 | 'audiotitle' => \is_array($audioTitle) ? implode($audioTitle) : $audioTitle, |
294 | 294 | ]); |
295 | 295 | } |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | { |
300 | 300 | $ckid = ReleaseSubtitle::query()->where('releases_id', $releaseID)->first(['releases_id']); |
301 | 301 | $subs = ''; |
302 | - if (! empty($subsLanguage)) { |
|
303 | - if (! empty($subsLanguage[1])) { |
|
302 | + if (!empty($subsLanguage)) { |
|
303 | + if (!empty($subsLanguage[1])) { |
|
304 | 304 | $subs = $subsLanguage[1]; |
305 | - } elseif (! empty($subsLanguage[0])) { |
|
305 | + } elseif (!empty($subsLanguage[0])) { |
|
306 | 306 | $subs = $subsLanguage[0]; |
307 | 307 | } |
308 | 308 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function deleteRegex(int $id): void |
151 | 151 | { |
152 | - DB::transaction(function () use ($id) { |
|
152 | + DB::transaction(function() use ($id) { |
|
153 | 153 | DB::delete(sprintf('DELETE FROM %s WHERE id = %d', $this->tableName, $id)); |
154 | 154 | }, 3); |
155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | { |
167 | 167 | $groupID = UsenetGroup::getIDByName($groupName); |
168 | 168 | |
169 | - if (! $groupID) { |
|
169 | + if (!$groupID) { |
|
170 | 170 | return []; |
171 | 171 | } |
172 | 172 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | ksort($hits); |
189 | 189 | $string = $string2 = ''; |
190 | 190 | foreach ($hits as $key => $hit) { |
191 | - if (! \is_int($key)) { |
|
191 | + if (!\is_int($key)) { |
|
192 | 192 | $string .= $hit; |
193 | 193 | $string2 .= '<br/>'.$key.': '.$hit; |
194 | 194 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $groupID = UsenetGroup::getIDByName($groupName); |
229 | 229 | |
230 | - if (! $groupID) { |
|
230 | + if (!$groupID) { |
|
231 | 231 | return []; |
232 | 232 | } |
233 | 233 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function beginImport($filesToProcess, $useNzbName = false, $delete = true, $deleteFailed = true) |
108 | 108 | { |
109 | 109 | // Get all the groups in the DB. |
110 | - if (! $this->getAllGroups()) { |
|
110 | + if (!$this->getAllGroups()) { |
|
111 | 111 | if ($this->browser) { |
112 | 112 | return $this->retVal; |
113 | 113 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | gzwrite($fp, $nzbString); |
168 | 168 | gzclose($fp); |
169 | 169 | |
170 | - if (! File::isFile($path)) { |
|
170 | + if (!File::isFile($path)) { |
|
171 | 171 | $this->echoOut('ERROR: Problem compressing NZB file to: '.$path); |
172 | 172 | |
173 | 173 | // Remove the release. |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | if ($groupID === -1) { |
256 | 256 | if (array_key_exists($group, $this->allGroups)) { |
257 | 257 | $groupID = $this->allGroups[$group]; |
258 | - if (! $groupName) { |
|
258 | + if (!$groupName) { |
|
259 | 259 | $groupName = $group; |
260 | 260 | } |
261 | 261 | } else { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | // If we found a group and it's not blacklisted. |
292 | - if ($groupID !== -1 && ! $isBlackListed) { |
|
292 | + if ($groupID !== -1 && !$isBlackListed) { |
|
293 | 293 | // Get the size of the release. |
294 | 294 | if (\count($file->segments->segment) > 0) { |
295 | 295 | foreach ($file->segments->segment as $segment) { |
@@ -134,7 +134,7 @@ |
||
134 | 134 | return 0; |
135 | 135 | } |
136 | 136 | // Check if it's on the drive. |
137 | - if (! File::isReadable($coverPath)) { |
|
137 | + if (!File::isReadable($coverPath)) { |
|
138 | 138 | return 0; |
139 | 139 | } |
140 | 140 |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->status = self::PROC_EXTFAIL; |
182 | 182 | } |
183 | 183 | |
184 | - if (! empty($hits['title'])) { |
|
184 | + if (!empty($hits['title'])) { |
|
185 | 185 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
186 | 186 | } |
187 | 187 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $anidbId = $this->getAnidbByName($tmpName); |
237 | 237 | } |
238 | 238 | |
239 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
239 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
240 | 240 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
241 | 241 | |
242 | 242 | if ($updatedAni === null) { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0; |
344 | 344 | |
345 | - if (! Settings::settingValue('apps..ffmpegpath')) { |
|
345 | + if (!Settings::settingValue('apps..ffmpegpath')) { |
|
346 | 346 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
347 | 347 | } else { |
348 | 348 | $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; |
354 | 354 | $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== ''; |
355 | 355 | $this->_processAudioInfo = $this->_processMediaInfo; |
356 | - $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); |
|
356 | + $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath')); |
|
357 | 357 | |
358 | 358 | $this->_audioSavePath = storage_path('covers/audiosample/'); |
359 | 359 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $this->_mainTmpPath = (string) Settings::settingValue('..tmpunrarpath'); |
411 | 411 | |
412 | 412 | // Check if it ends with a dir separator. |
413 | - if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
413 | + if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
414 | 414 | $this->_mainTmpPath .= '/'; |
415 | 415 | } |
416 | 416 | |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | $this->_mainTmpPath .= ($guidChar.'/'); |
422 | 422 | } |
423 | 423 | |
424 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
425 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
424 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
425 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
426 | 426 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
430 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
431 | 431 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
432 | 432 | } |
433 | 433 | |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | if ($this->_minSize > 0) { |
473 | 473 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
474 | 474 | } |
475 | - if (! empty($groupID)) { |
|
475 | + if (!empty($groupID)) { |
|
476 | 476 | $releasesQuery->where('releases.groups_id', $groupID); |
477 | 477 | } |
478 | - if (! empty($guidChar)) { |
|
478 | + if (!empty($guidChar)) { |
|
479 | 479 | $releasesQuery->where('releases.leftguid', $guidChar); |
480 | 480 | } |
481 | 481 | $releasesQuery->select(['releases.id', 'releases.id as releases_id', 'releases.guid', 'releases.name', 'releases.size', 'releases.groups_id', 'releases.nfostatus', 'releases.fromname', 'releases.completion', 'releases.categories_id', 'releases.searchname', 'releases.predb_id', 'categories.disablepreview']) |
@@ -529,12 +529,12 @@ discard block |
||
529 | 529 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
530 | 530 | |
531 | 531 | // Create folder to store temporary files. |
532 | - if (! $this->_createTempFolder()) { |
|
532 | + if (!$this->_createTempFolder()) { |
|
533 | 533 | continue; |
534 | 534 | } |
535 | 535 | |
536 | 536 | // Get NZB contents. |
537 | - if (! $this->_getNZBContents()) { |
|
537 | + if (!$this->_getNZBContents()) { |
|
538 | 538 | continue; |
539 | 539 | } |
540 | 540 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $this->_processMessageIDDownloads(); |
557 | 557 | |
558 | 558 | // Process compressed (RAR/ZIP) files inside the NZB. |
559 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
559 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
560 | 560 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
561 | 561 | $this->_processNZBCompressedFiles(); |
562 | 562 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | $this->_processNZBCompressedFiles(true); |
566 | 566 | } |
567 | 567 | |
568 | - if (! $this->_releaseHasPassword) { |
|
568 | + if (!$this->_releaseHasPassword) { |
|
569 | 569 | // Process the extracted files to get video/audio samples/etc. |
570 | 570 | $this->_processExtractedFiles(); |
571 | 571 | } |
@@ -610,8 +610,8 @@ discard block |
||
610 | 610 | { |
611 | 611 | // Per release defaults. |
612 | 612 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
613 | - if (! File::isDirectory($this->tmpPath)) { |
|
614 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
613 | + if (!File::isDirectory($this->tmpPath)) { |
|
614 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
615 | 615 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
616 | 616 | $this->_deleteRelease(); |
617 | 617 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
634 | 634 | if ($nzbPath !== false) { |
635 | 635 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
636 | - if (! $nzbContents) { |
|
636 | + if (!$nzbContents) { |
|
637 | 637 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
638 | 638 | $this->_deleteRelease(); |
639 | 639 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | // Check if it's a rar/zip. |
691 | - if (! $this->_NZBHasCompressedFile && |
|
691 | + if (!$this->_NZBHasCompressedFile && |
|
692 | 692 | preg_match( |
693 | 693 | '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', |
694 | 694 | $this->_currentNZBFile['title'] |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | } |
699 | 699 | |
700 | 700 | // Look for a video sample, make sure it's not an image. |
701 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
701 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
702 | 702 | ) { |
703 | 703 | // Get the amount of segments for this file. |
704 | 704 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } |
713 | 713 | |
714 | 714 | // Look for a JPG picture, make sure it's not a CD cover. |
715 | - if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) |
|
715 | + if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) |
|
716 | 716 | ) { |
717 | 717 | // Get the amount of segments for this file. |
718 | 718 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $this->_reverse = $reverse; |
765 | 765 | |
766 | 766 | if ($this->_reverse) { |
767 | - if (! krsort($this->_nzbContents)) { |
|
767 | + if (!krsort($this->_nzbContents)) { |
|
768 | 768 | return; |
769 | 769 | } |
770 | 770 | } else { |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | } |
789 | 789 | |
790 | 790 | // Probably not a rar/zip. |
791 | - if (! preg_match( |
|
791 | + if (!preg_match( |
|
792 | 792 | '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', |
793 | 793 | $nzbFile['title'] |
794 | 794 | ) |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | break; |
805 | 805 | } |
806 | 806 | $segment = (string) $nzbFile['segments'][$i]; |
807 | - if (! $this->_reverse) { |
|
807 | + if (!$this->_reverse) { |
|
808 | 808 | $this->_triedCompressedMids[] = $segment; |
809 | 809 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
810 | 810 | // We already downloaded this file. |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | { |
857 | 857 | $this->_compressedFilesChecked++; |
858 | 858 | // Give the data to archive info so it can check if it's a rar. |
859 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
859 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
860 | 860 | if (config('app.debug') === true) { |
861 | 861 | $this->_debug('Data is probably not RAR or ZIP.'); |
862 | 862 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | } |
887 | 887 | |
888 | 888 | // Check if the compressed file is encrypted. |
889 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
889 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
890 | 890 | if (config('app.debug') === true) { |
891 | 891 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
892 | 892 | } |
@@ -898,13 +898,13 @@ discard block |
||
898 | 898 | |
899 | 899 | if ($this->_reverse) { |
900 | 900 | $fileData = $dataSummary['file_list'] ?? []; |
901 | - if (! empty($fileData)) { |
|
901 | + if (!empty($fileData)) { |
|
902 | 902 | $rarFileName = Arr::pluck($fileData, 'name'); |
903 | 903 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
904 | 904 | $preCheck = Predb::whereTitle($hit[0])->first(); |
905 | 905 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
906 | 906 | (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
907 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
907 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
908 | 908 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
909 | 909 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
910 | 910 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | $this->_echo('r', 'primaryOver'); |
923 | 923 | } |
924 | 924 | |
925 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
925 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
926 | 926 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
927 | 927 | File::put($fileName, $compressedData); |
928 | 928 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | $this->_echo('z', 'primaryOver'); |
935 | 935 | } |
936 | 936 | |
937 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
937 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
938 | 938 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
939 | 939 | File::put($fileName, $compressedData); |
940 | 940 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | { |
960 | 960 | // Get a list of files inside the Compressed file. |
961 | 961 | $files = $this->_archiveInfo->getArchiveFileList(); |
962 | - if (! \is_array($files) || \count($files) === 0) { |
|
962 | + if (!\is_array($files) || \count($files) === 0) { |
|
963 | 963 | return false; |
964 | 964 | } |
965 | 965 | |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | protected function _addFileInfo(&$file): void |
1030 | 1030 | { |
1031 | 1031 | // Don't add rar/zip files to the DB. |
1032 | - if (! isset($file['error']) && isset($file['source']) && |
|
1033 | - ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) |
|
1032 | + if (!isset($file['error']) && isset($file['source']) && |
|
1033 | + !preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) |
|
1034 | 1034 | ) { |
1035 | 1035 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
1036 | 1036 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | */ |
1042 | 1042 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
1043 | 1043 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
1044 | - if (! empty($addReleaseFiles)) { |
|
1044 | + if (!empty($addReleaseFiles)) { |
|
1045 | 1045 | $this->_addedFileInfo++; |
1046 | 1046 | |
1047 | 1047 | if ($this->_echoCLI) { |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | $this->_releaseHasPassword = true; |
1059 | 1059 | $this->_passwordStatus = Releases::PASSWD_RAR; |
1060 | 1060 | } //Run a PreDB filename check on insert to try and match the release |
1061 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
1061 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
1062 | 1062 | $this->_release['filename'] = $file['name']; |
1063 | 1063 | $this->_release['releases_id'] = $this->_release->id; |
1064 | 1064 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | // If we found no compressed files, break out. |
1107 | - if (! $foundCompressedFile) { |
|
1107 | + if (!$foundCompressedFile) { |
|
1108 | 1108 | break; |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1126,39 +1126,39 @@ discard block |
||
1126 | 1126 | |
1127 | 1127 | if (File::isFile($file)) { |
1128 | 1128 | // Process PAR2 files. |
1129 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1129 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1130 | 1130 | $this->_siftPAR2Info($file); |
1131 | 1131 | } // Process NFO files. |
1132 | 1132 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
1133 | 1133 | $this->_processNfoFile($file); |
1134 | 1134 | } // Process audio files. |
1135 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1135 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1136 | 1136 | // Try to get audio sample/audio media info. |
1137 | 1137 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
1138 | 1138 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
1139 | 1139 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
1140 | 1140 | } // Process JPG files. |
1141 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1141 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1142 | 1142 | $this->_getJPGSample($file); |
1143 | 1143 | File::delete($file); |
1144 | 1144 | } // Video sample // video clip // video media info. |
1145 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1145 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1146 | 1146 | $this->_processVideoFile($file); |
1147 | 1147 | } // Check file's magic info. |
1148 | 1148 | else { |
1149 | 1149 | $output = Utility::fileInfo($file); |
1150 | - if (! empty($output)) { |
|
1150 | + if (!empty($output)) { |
|
1151 | 1151 | switch (true) { |
1152 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1152 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1153 | 1153 | $this->_getJPGSample($file); |
1154 | 1154 | File::delete($file); |
1155 | 1155 | break; |
1156 | 1156 | |
1157 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1157 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1158 | 1158 | $this->_processVideoFile($file); |
1159 | 1159 | break; |
1160 | 1160 | |
1161 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1161 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1162 | 1162 | switch ($fileType[0]) { |
1163 | 1163 | case 'FLAC': |
1164 | 1164 | $fileType = 'FLAC'; |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
1176 | 1176 | break; |
1177 | 1177 | |
1178 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1178 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1179 | 1179 | $this->_siftPAR2Info($file); |
1180 | 1180 | break; |
1181 | 1181 | } |
@@ -1211,8 +1211,8 @@ discard block |
||
1211 | 1211 | protected function _processSampleMessageIDs(): void |
1212 | 1212 | { |
1213 | 1213 | // Download and process sample image. |
1214 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
1215 | - if (! empty($this->_sampleMessageIDs)) { |
|
1214 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
1215 | + if (!empty($this->_sampleMessageIDs)) { |
|
1216 | 1216 | // Download it from usenet. |
1217 | 1217 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
1218 | 1218 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1231,12 +1231,12 @@ discard block |
||
1231 | 1231 | File::put($fileLocation, $sampleBinary); |
1232 | 1232 | |
1233 | 1233 | // Try to get a sample picture. |
1234 | - if (! $this->_foundSample) { |
|
1234 | + if (!$this->_foundSample) { |
|
1235 | 1235 | $this->_foundSample = $this->_getSample($fileLocation); |
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | // Try to get a sample video. |
1239 | - if (! $this->_foundVideo) { |
|
1239 | + if (!$this->_foundVideo) { |
|
1240 | 1240 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1257,8 +1257,8 @@ discard block |
||
1257 | 1257 | protected function _processMediaInfoMessageIDs(): void |
1258 | 1258 | { |
1259 | 1259 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
1260 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
1261 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
1260 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
1261 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
1262 | 1262 | // Try to download it from usenet. |
1263 | 1263 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
1264 | 1264 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1278,17 +1278,17 @@ discard block |
||
1278 | 1278 | File::put($fileLocation, $mediaBinary); |
1279 | 1279 | |
1280 | 1280 | // Try to get media info. |
1281 | - if (! $this->_foundMediaInfo) { |
|
1281 | + if (!$this->_foundMediaInfo) { |
|
1282 | 1282 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | // Try to get a sample picture. |
1286 | - if (! $this->_foundSample) { |
|
1286 | + if (!$this->_foundSample) { |
|
1287 | 1287 | $this->_foundSample = $this->_getSample($fileLocation); |
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | // Try to get a sample video. |
1291 | - if (! $this->_foundVideo) { |
|
1291 | + if (!$this->_foundVideo) { |
|
1292 | 1292 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1293 | 1293 | } |
1294 | 1294 | } |
@@ -1309,8 +1309,8 @@ discard block |
||
1309 | 1309 | protected function _processAudioInfoMessageIDs(): void |
1310 | 1310 | { |
1311 | 1311 | // Download audio file, use media info to try to get the artist / album. |
1312 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
1313 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
1312 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
1313 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
1314 | 1314 | // Try to download it from usenet. |
1315 | 1315 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
1316 | 1316 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | protected function _processJPGMessageIDs(): void |
1346 | 1346 | { |
1347 | 1347 | // Download JPG file. |
1348 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
1348 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
1349 | 1349 | // Try to download it. |
1350 | 1350 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
1351 | 1351 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1418,12 +1418,12 @@ discard block |
||
1418 | 1418 | $this->_passwordStatus = max([$this->_passwordStatus]); |
1419 | 1419 | |
1420 | 1420 | // Set the release to no password if password processing is off. |
1421 | - if (! $this->_processPasswords) { |
|
1421 | + if (!$this->_processPasswords) { |
|
1422 | 1422 | $this->_releaseHasPassword = false; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password. |
1426 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1426 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1427 | 1427 | $release = Release::query()->where('id', $this->_release->id); |
1428 | 1428 | $release->decrement('passwordstatus'); |
1429 | 1429 | $release->update( |
@@ -1481,19 +1481,19 @@ discard block |
||
1481 | 1481 | $retVal = $audVal = false; |
1482 | 1482 | |
1483 | 1483 | // Check if audio sample fetching is on. |
1484 | - if (! $this->_processAudioSample) { |
|
1484 | + if (!$this->_processAudioSample) { |
|
1485 | 1485 | $audVal = true; |
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | // Check if media info fetching is on. |
1489 | - if (! $this->_processAudioInfo) { |
|
1489 | + if (!$this->_processAudioInfo) { |
|
1490 | 1490 | $retVal = true; |
1491 | 1491 | } |
1492 | 1492 | |
1493 | 1493 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
1494 | 1494 | |
1495 | 1495 | $musicParent = (string) Category::MUSIC_ROOT; |
1496 | - if ($rQuery === null || ! preg_match( |
|
1496 | + if ($rQuery === null || !preg_match( |
|
1497 | 1497 | sprintf( |
1498 | 1498 | '/%d\d{3}|%d|%d|%d/', |
1499 | 1499 | $musicParent[0], |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | |
1510 | 1510 | if (File::isFile($fileLocation)) { |
1511 | 1511 | // Check if media info is enabled. |
1512 | - if (! $retVal) { |
|
1512 | + if (!$retVal) { |
|
1513 | 1513 | // Get the media info for the file. |
1514 | 1514 | try { |
1515 | 1515 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | $ext = strtoupper($fileExtension); |
1523 | 1523 | |
1524 | 1524 | // Form a new search name. |
1525 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1525 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1526 | 1526 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
1527 | 1527 | } else { |
1528 | 1528 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | } |
1585 | 1585 | |
1586 | 1586 | // Check if creating audio samples is enabled. |
1587 | - if (! $audVal) { |
|
1587 | + if (!$audVal) { |
|
1588 | 1588 | // File name to store audio file. |
1589 | 1589 | $audioFileName = ($this->_release->guid.'.ogg'); |
1590 | 1590 | |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | // Try to move the temp audio file. |
1609 | 1609 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1610 | 1610 | |
1611 | - if (! $renamed) { |
|
1611 | + if (!$renamed) { |
|
1612 | 1612 | // Try to copy it if it fails. |
1613 | 1613 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1614 | 1614 | |
@@ -1616,7 +1616,7 @@ discard block |
||
1616 | 1616 | File::delete($this->tmpPath.$audioFileName); |
1617 | 1617 | |
1618 | 1618 | // If it didn't copy continue. |
1619 | - if (! $copied) { |
|
1619 | + if (!$copied) { |
|
1620 | 1620 | return false; |
1621 | 1621 | } |
1622 | 1622 | } |
@@ -1668,7 +1668,7 @@ discard block |
||
1668 | 1668 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
1669 | 1669 | } |
1670 | 1670 | |
1671 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1671 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1672 | 1672 | return ''; |
1673 | 1673 | } |
1674 | 1674 | |
@@ -1689,7 +1689,7 @@ discard block |
||
1689 | 1689 | */ |
1690 | 1690 | protected function _getSample(string $fileLocation): bool |
1691 | 1691 | { |
1692 | - if (! $this->_processThumbnails) { |
|
1692 | + if (!$this->_processThumbnails) { |
|
1693 | 1693 | return false; |
1694 | 1694 | } |
1695 | 1695 | |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | */ |
1755 | 1755 | protected function _getVideo(string $fileLocation): bool |
1756 | 1756 | { |
1757 | - if (! $this->_processVideo) { |
|
1757 | + if (!$this->_processVideo) { |
|
1758 | 1758 | return false; |
1759 | 1759 | } |
1760 | 1760 | |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | // If longer than 60 or we could not get the video length, run the old way. |
1812 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1812 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1813 | 1813 | try { |
1814 | 1814 | $video = $this->ffmpeg->open($fileLocation); |
1815 | 1815 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1832,14 +1832,14 @@ discard block |
||
1832 | 1832 | |
1833 | 1833 | // Try to move the file to the new path. |
1834 | 1834 | // If we couldn't rename it, try to copy it. |
1835 | - if (! @File::move($fileName, $newFile)) { |
|
1835 | + if (!@File::move($fileName, $newFile)) { |
|
1836 | 1836 | $copied = @File::copy($fileName, $newFile); |
1837 | 1837 | |
1838 | 1838 | // Delete the old file. |
1839 | 1839 | File::delete($fileName); |
1840 | 1840 | |
1841 | 1841 | // If it didn't copy, continue. |
1842 | - if (! $copied) { |
|
1842 | + if (!$copied) { |
|
1843 | 1843 | return false; |
1844 | 1844 | } |
1845 | 1845 | } |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | */ |
1866 | 1866 | protected function _getMediaInfo($fileLocation): bool |
1867 | 1867 | { |
1868 | - if (! $this->_processMediaInfo) { |
|
1868 | + if (!$this->_processMediaInfo) { |
|
1869 | 1869 | return false; |
1870 | 1870 | } |
1871 | 1871 | |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | $filesAdded = 0; |
1941 | 1941 | |
1942 | 1942 | foreach ($this->_par2Info->getFileList() as $file) { |
1943 | - if (! isset($file['name'])) { |
|
1943 | + if (!isset($file['name'])) { |
|
1944 | 1944 | continue; |
1945 | 1945 | } |
1946 | 1946 | |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | } |
1964 | 1964 | |
1965 | 1965 | // Try to get a new name. |
1966 | - if (! $foundName) { |
|
1966 | + if (!$foundName) { |
|
1967 | 1967 | $this->_release->textstring = $file['name']; |
1968 | 1968 | $this->_release->releases_id = $this->_release->id; |
1969 | 1969 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -1993,7 +1993,7 @@ discard block |
||
1993 | 1993 | protected function _processVideoFile($fileLocation): void |
1994 | 1994 | { |
1995 | 1995 | // Try to get a sample with it. |
1996 | - if (! $this->_foundSample) { |
|
1996 | + if (!$this->_foundSample) { |
|
1997 | 1997 | $this->_foundSample = $this->_getSample($fileLocation); |
1998 | 1998 | } |
1999 | 1999 | |
@@ -2001,12 +2001,12 @@ discard block |
||
2001 | 2001 | * Don't get it here if _sampleMessageIDs is empty |
2002 | 2002 | * or has 1 message-id (Saves downloading another part). |
2003 | 2003 | */ |
2004 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
2004 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
2005 | 2005 | $this->_foundVideo = $this->_getVideo($fileLocation); |
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | // Try to get media info with it. |
2009 | - if (! $this->_foundMediaInfo) { |
|
2009 | + if (!$this->_foundMediaInfo) { |
|
2010 | 2010 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
2011 | 2011 | } |
2012 | 2012 | } |
@@ -2028,24 +2028,24 @@ discard block |
||
2028 | 2028 | $bf = true; |
2029 | 2029 | } |
2030 | 2030 | |
2031 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2031 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2032 | 2032 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
2033 | 2033 | $af = true; |
2034 | 2034 | } |
2035 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2035 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2036 | 2036 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
2037 | 2037 | $bf = true; |
2038 | 2038 | } |
2039 | 2039 | |
2040 | - if (! $af && ! $bf) { |
|
2040 | + if (!$af && !$bf) { |
|
2041 | 2041 | return strnatcasecmp($a, $b); |
2042 | 2042 | } |
2043 | 2043 | |
2044 | - if (! $bf) { |
|
2044 | + if (!$bf) { |
|
2045 | 2045 | return -1; |
2046 | 2046 | } |
2047 | 2047 | |
2048 | - if (! $af) { |
|
2048 | + if (!$af) { |
|
2049 | 2049 | return 1; |
2050 | 2050 | } |
2051 | 2051 | |
@@ -2070,12 +2070,12 @@ discard block |
||
2070 | 2070 | protected function _resetReleaseStatus(): void |
2071 | 2071 | { |
2072 | 2072 | // Only process for samples, previews and images if not disabled. |
2073 | - $this->_foundVideo = ! $this->_processVideo; |
|
2074 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
2075 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
2076 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
2077 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
2078 | - $this->_foundSample = ! $this->_processThumbnails; |
|
2073 | + $this->_foundVideo = !$this->_processVideo; |
|
2074 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
2075 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
2076 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
2077 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
2078 | + $this->_foundSample = !$this->_processThumbnails; |
|
2079 | 2079 | $this->_foundPAR2Info = false; |
2080 | 2080 | |
2081 | 2081 | $this->_passwordStatus = Releases::PASSWD_NONE; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (\in_array($siteColumn, self::$sites, false)) { |
101 | 101 | $result = Video::query()->where($siteColumn, $siteID)->first(); |
102 | 102 | } |
103 | - if (! empty($result)) { |
|
103 | + if (!empty($result)) { |
|
104 | 104 | $query = $result->toArray(); |
105 | 105 | |
106 | 106 | return $query['id']; |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | public function getTitleExact(string $title, int $type, int $source = 0): int |
181 | 181 | { |
182 | 182 | $return = 0; |
183 | - if (! empty($title)) { |
|
183 | + if (!empty($title)) { |
|
184 | 184 | $sql = Video::query()->where(['title' => $title, 'type' => $type]); |
185 | 185 | if ($source > 0) { |
186 | 186 | $sql->where('source', $source); |
187 | 187 | } |
188 | 188 | $query = $sql->first(); |
189 | - if (! empty($query)) { |
|
189 | + if (!empty($query)) { |
|
190 | 190 | $result = $query->toArray(); |
191 | 191 | $return = $result['id']; |
192 | 192 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $sql->where('videos.source', $source); |
200 | 200 | } |
201 | 201 | $query = $sql->first(); |
202 | - if (! empty($query)) { |
|
202 | + if (!empty($query)) { |
|
203 | 203 | $result = $query->toArray(); |
204 | 204 | $return = $result['id']; |
205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $return = 0; |
218 | 218 | |
219 | - if (! empty($title)) { |
|
219 | + if (!empty($title)) { |
|
220 | 220 | $sql = Video::query() |
221 | 221 | ->where('title', 'like', rtrim($title, '%')) |
222 | 222 | ->where('type', $type); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $sql->where('source', $source); |
225 | 225 | } |
226 | 226 | $query = $sql->first(); |
227 | - if (! empty($query)) { |
|
227 | + if (!empty($query)) { |
|
228 | 228 | $result = $query->toArray(); |
229 | 229 | $return = $result['id']; |
230 | 230 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $sql->where('videos.source', $source); |
239 | 239 | } |
240 | 240 | $query = $sql->first(); |
241 | - if (! empty($query)) { |
|
241 | + if (!empty($query)) { |
|
242 | 242 | $result = $query->toArray(); |
243 | 243 | $return = $result['id']; |
244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | public function getAlternativeTitleExact(string $title, int $type, int $source = 0): mixed |
255 | 255 | { |
256 | 256 | $return = 0; |
257 | - if (! empty($title)) { |
|
257 | + if (!empty($title)) { |
|
258 | 258 | if ($source > 0) { |
259 | 259 | $query = Video::query() |
260 | 260 | ->whereRaw("REPLACE(title,'\'','') = ?", $title) |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | ->where('type', '=', $type) |
270 | 270 | ->first(); |
271 | 271 | } |
272 | - if (! empty($query)) { |
|
272 | + if (!empty($query)) { |
|
273 | 273 | $result = $query->toArray(); |
274 | 274 | |
275 | 275 | return $result['id']; |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function addAliases($videoId, array $aliases = []): void |
286 | 286 | { |
287 | - if (! empty($aliases) && $videoId > 0) { |
|
287 | + if (!empty($aliases) && $videoId > 0) { |
|
288 | 288 | foreach ($aliases as $key => $title) { |
289 | 289 | // Check for tvmaze style aka |
290 | - if (\is_array($title) && ! empty($title['name'])) { |
|
290 | + if (\is_array($title) && !empty($title['name'])) { |
|
291 | 291 | $title = $title['name']; |
292 | 292 | } |
293 | 293 | // Check if we have the AKA already |
@@ -274,7 +274,7 @@ |
||
274 | 274 | |
275 | 275 | // Loop through the files. |
276 | 276 | foreach ($files as $file) { |
277 | - if (! isset($file['name'])) { |
|
277 | + if (!isset($file['name'])) { |
|
278 | 278 | continue; |
279 | 279 | } |
280 | 280 |