@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (empty($email) && empty($rssToken)) { |
47 | 47 | app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset'); |
48 | 48 | } else { |
49 | - if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { |
|
49 | + if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) { |
|
50 | 50 | $this->validate($request, [ |
51 | 51 | 'g-recaptcha-response' => 'required|captcha', |
52 | 52 | ]); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // |
55 | 55 | // Check users exists and send an email |
56 | 56 | // |
57 | - $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
57 | + $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email); |
|
58 | 58 | if ($ret === null) { |
59 | 59 | app('smarty.view')->assign('error', 'The email or apikey are not recognised.'); |
60 | 60 | $sent = true; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Symfony\Component\Process\Process; |
17 | 17 | use Zip as ZipStream; |
18 | 18 | |
19 | -if (! function_exists('getRawHtml')) { |
|
19 | +if (!function_exists('getRawHtml')) { |
|
20 | 20 | /** |
21 | 21 | * @param bool $cookie |
22 | 22 | * @return bool|mixed|string |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if (! function_exists('makeFieldLinks')) { |
|
54 | +if (!function_exists('makeFieldLinks')) { |
|
55 | 55 | /** |
56 | 56 | * @return string |
57 | 57 | * |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -if (! function_exists('getUserBrowseOrder')) { |
|
84 | +if (!function_exists('getUserBrowseOrder')) { |
|
85 | 85 | /** |
86 | 86 | * @param string $orderBy |
87 | 87 | */ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if (! function_exists('getUserBrowseOrdering')) { |
|
110 | +if (!function_exists('getUserBrowseOrdering')) { |
|
111 | 111 | function getUserBrowseOrdering(): array |
112 | 112 | { |
113 | 113 | return [ |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | -if (! function_exists('createGUID')) { |
|
140 | +if (!function_exists('createGUID')) { |
|
141 | 141 | /** |
142 | 142 | * @throws Exception |
143 | 143 | */ |
144 | 144 | function createGUID(): string |
145 | 145 | { |
146 | 146 | $data = random_bytes(16); |
147 | - $data[6] = \chr(\ord($data[6]) & 0x0F | 0x40); // set version to 0100 |
|
148 | - $data[8] = \chr(\ord($data[8]) & 0x3F | 0x80); // set bits 6-7 to 10 |
|
147 | + $data[6] = \chr(\ord($data[6]) & 0x0F|0x40); // set version to 0100 |
|
148 | + $data[8] = \chr(\ord($data[8]) & 0x3F|0x80); // set bits 6-7 to 10 |
|
149 | 149 | |
150 | 150 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4)); |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if (! function_exists('getSimilarName')) { |
|
154 | +if (!function_exists('getSimilarName')) { |
|
155 | 155 | /** |
156 | 156 | * @param string $name |
157 | 157 | */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | -if (! function_exists('color')) { |
|
164 | +if (!function_exists('color')) { |
|
165 | 165 | /** |
166 | 166 | * @param string $string |
167 | 167 | */ |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists('human_filesize')) { |
|
174 | +if (!function_exists('human_filesize')) { |
|
175 | 175 | /** |
176 | 176 | * @param int $decimals |
177 | 177 | */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | -if (! function_exists('bcdechex')) { |
|
187 | +if (!function_exists('bcdechex')) { |
|
188 | 188 | /** |
189 | 189 | * @return string |
190 | 190 | */ |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -if (! function_exists('runCmd')) { |
|
204 | +if (!function_exists('runCmd')) { |
|
205 | 205 | /** |
206 | 206 | * Run CLI command. |
207 | 207 | * |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | -if (! function_exists('escapeString')) { |
|
232 | +if (!function_exists('escapeString')) { |
|
233 | 233 | /** |
234 | 234 | * @return string |
235 | 235 | */ |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -if (! function_exists('realDuration')) { |
|
242 | +if (!function_exists('realDuration')) { |
|
243 | 243 | /** |
244 | 244 | * @return string |
245 | 245 | */ |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | -if (! function_exists('is_it_json')) { |
|
254 | +if (!function_exists('is_it_json')) { |
|
255 | 255 | /** |
256 | 256 | * @param array|string $isIt |
257 | 257 | * @return bool |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | return $zipped; |
295 | 295 | } |
296 | 296 | |
297 | -if (! function_exists('release_flag')) { |
|
297 | +if (!function_exists('release_flag')) { |
|
298 | 298 | // Function inspired by c0r3@newznabforums adds country flags on the browse page. |
299 | 299 | /** |
300 | 300 | * @param string $text Text to match against. |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | |
431 | 431 | return ''; |
432 | 432 | } |
433 | - if (! function_exists('sanitize')) { |
|
433 | + if (!function_exists('sanitize')) { |
|
434 | 434 | function sanitize(array|string $phrases, array $doNotSanitize = []): string |
435 | 435 | { |
436 | - if (! is_array($phrases)) { |
|
436 | + if (!is_array($phrases)) { |
|
437 | 437 | $wordArray = explode(' ', str_replace('.', ' ', $phrases)); |
438 | 438 | } else { |
439 | 439 | $wordArray = $phrases; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | foreach ($wordArray as $words) { |
445 | 445 | $words = preg_split('/\s+/', $words); |
446 | 446 | foreach ($words as $st) { |
447 | - if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
447 | + if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
448 | 448 | $str = $st; |
449 | - } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
449 | + } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
450 | 450 | $str = $st; |
451 | 451 | } else { |
452 | 452 | $str = Sanitizer::escape($st, $doNotSanitize); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | $binaries = new Binaries(['NNTP' => $nntp]); |
21 | 21 | |
22 | -if (isset($argv[1]) && ! is_numeric($argv[1])) { |
|
22 | +if (isset($argv[1]) && !is_numeric($argv[1])) { |
|
23 | 23 | $groupName = $argv[1]; |
24 | 24 | $colorCli->header("Updating group: $groupName"); |
25 | 25 | |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } else { |
38 | 38 | try { |
39 | - $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : |
|
40 | - $maxHeaders)); |
|
39 | + $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : $maxHeaders)); |
|
41 | 40 | } catch (Throwable $e) { |
42 | 41 | Illuminate\Support\Facades\Log::error($e->getMessage()); |
43 | 42 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | 'false', |
35 | 35 | ]; |
36 | 36 | |
37 | -if (! isset($argv[1], $argv[2]) || ! in_array($argv[1], $args, false) || ! in_array($argv[2], $bool, false)) { |
|
37 | +if (!isset($argv[1], $argv[2]) || !in_array($argv[1], $args, false) || !in_array($argv[2], $bool, false)) { |
|
38 | 38 | exit( |
39 | 39 | (new Blacklight\ColorCLI())->error( |
40 | 40 | "\nIncorrect arguments.\n" |
@@ -115,7 +115,7 @@ |
||
115 | 115 | $user = User::query()->where('email', '=', $payload['metadata']['buyerEmail'])->first(); |
116 | 116 | if ($user) { |
117 | 117 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
118 | - if (! empty($checkOrder)) { |
|
118 | + if (!empty($checkOrder)) { |
|
119 | 119 | Log::error('Duplicate BTCPay webhook: '.$payload['webhookId']); |
120 | 120 | |
121 | 121 | return response('Not Found', 404); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'airdate', |
94 | 94 | 'episode_title', |
95 | 95 | ])->first(); |
96 | - if (! empty($result)) { |
|
96 | + if (!empty($result)) { |
|
97 | 97 | return $result->toArray(); |
98 | 98 | } |
99 | 99 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->status = self::PROC_EXTFAIL; |
144 | 144 | } |
145 | 145 | |
146 | - if (! empty($hits['title'])) { |
|
146 | + if (!empty($hits['title'])) { |
|
147 | 147 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
148 | 148 | } |
149 | 149 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $anidbId = $this->getAnidbByName($tmpName); |
188 | 188 | } |
189 | 189 | |
190 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
190 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
191 | 191 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
192 | 192 | if (empty($updatedAni)) { |
193 | - if (! empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
193 | + if (!empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
194 | 194 | $this->padb->populateTable('info', $anidbId->anidbid); |
195 | 195 | $this->doRandomSleep(); |
196 | 196 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function updatePreDb(array $parameters): void |
155 | 155 | { |
156 | - if (! empty($parameters)) { |
|
156 | + if (!empty($parameters)) { |
|
157 | 157 | $this->insertPredb($parameters); |
158 | 158 | } |
159 | 159 | } |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | $resultData = []; |
215 | 215 | try { |
216 | 216 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
217 | - if (! empty($searchArray)) { |
|
217 | + if (!empty($searchArray)) { |
|
218 | 218 | foreach ($searchArray as $key => $value) { |
219 | 219 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
220 | 220 | } |
221 | - } elseif (! empty($searchString)) { |
|
221 | + } elseif (!empty($searchString)) { |
|
222 | 222 | // If $column is an array and has more than one item, implode it and wrap in parentheses. |
223 | - if (! empty($column) && \count($column) > 1) { |
|
223 | + if (!empty($column) && \count($column) > 1) { |
|
224 | 224 | $searchColumns = '@('.implode(',', $column).')'; |
225 | - } elseif (! empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
225 | + } elseif (!empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
226 | 226 | $searchColumns = '@'.$column[0]; |
227 | 227 | } else { |
228 | 228 | $searchColumns = ''; // Careful, this will search all columns. |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | |
292 | 292 | // Pass the binary extractors to ArchiveInfo. |
293 | 293 | $clients = []; |
294 | - if (! empty(Settings::settingValue('apps..unrarpath'))) { |
|
294 | + if (!empty(Settings::settingValue('apps..unrarpath'))) { |
|
295 | 295 | $this->_unrarPath = Settings::settingValue('apps..unrarpath'); |
296 | 296 | $clients += [ArchiveInfo::TYPE_RAR => $this->_unrarPath]; |
297 | 297 | } |
298 | - if (! empty(Settings::settingValue('apps..zippath'))) { |
|
298 | + if (!empty(Settings::settingValue('apps..zippath'))) { |
|
299 | 299 | $this->_7zipPath = Settings::settingValue('apps..zippath'); |
300 | 300 | $clients += [ArchiveInfo::TYPE_SZIP => $this->_7zipPath]; |
301 | 301 | $clients += [ArchiveInfo::TYPE_ZIP => $this->_7zipPath]; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $this->_archiveInfo->setExternalClients($clients); |
304 | 304 | |
305 | 305 | $this->_killString = '"'; |
306 | - if (! empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
306 | + if (!empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) { |
|
307 | 307 | $this->_killString = ( |
308 | 308 | '"'.Settings::settingValue('apps..timeoutpath'). |
309 | 309 | '" --foreground --signal=KILL '. |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0; |
345 | 345 | |
346 | - if (! Settings::settingValue('apps..ffmpegpath')) { |
|
346 | + if (!Settings::settingValue('apps..ffmpegpath')) { |
|
347 | 347 | $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; |
348 | 348 | } else { |
349 | 349 | $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; |
355 | 355 | $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== ''; |
356 | 356 | $this->_processAudioInfo = $this->_processMediaInfo; |
357 | - $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath')); |
|
357 | + $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath')); |
|
358 | 358 | |
359 | 359 | $this->_audioSavePath = storage_path('covers/audiosample/'); |
360 | 360 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $this->_mainTmpPath = (string) Settings::settingValue('..tmpunrarpath'); |
412 | 412 | |
413 | 413 | // Check if it ends with a dir separator. |
414 | - if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
414 | + if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) { |
|
415 | 415 | $this->_mainTmpPath .= '/'; |
416 | 416 | } |
417 | 417 | |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | $this->_mainTmpPath .= ($guidChar.'/'); |
423 | 423 | } |
424 | 424 | |
425 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
426 | - if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) { |
|
425 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
426 | + if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) { |
|
427 | 427 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath)); |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - if (! File::isDirectory($this->_mainTmpPath)) { |
|
431 | + if (!File::isDirectory($this->_mainTmpPath)) { |
|
432 | 432 | throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')'); |
433 | 433 | } |
434 | 434 | |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | if ($this->_minSize > 0) { |
474 | 474 | $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576); |
475 | 475 | } |
476 | - if (! empty($groupID)) { |
|
476 | + if (!empty($groupID)) { |
|
477 | 477 | $releasesQuery->where('releases.groups_id', $groupID); |
478 | 478 | } |
479 | - if (! empty($guidChar)) { |
|
479 | + if (!empty($guidChar)) { |
|
480 | 480 | $releasesQuery->where('releases.leftguid', $guidChar); |
481 | 481 | } |
482 | 482 | $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']) |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | cli_set_process_title($this->_showCLIReleaseID.$this->_release->id); |
531 | 531 | |
532 | 532 | // Create folder to store temporary files. |
533 | - if (! $this->_createTempFolder()) { |
|
533 | + if (!$this->_createTempFolder()) { |
|
534 | 534 | continue; |
535 | 535 | } |
536 | 536 | |
537 | 537 | // Get NZB contents. |
538 | - if (! $this->_getNZBContents()) { |
|
538 | + if (!$this->_getNZBContents()) { |
|
539 | 539 | continue; |
540 | 540 | } |
541 | 541 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $this->_processMessageIDDownloads(); |
558 | 558 | |
559 | 559 | // Process compressed (RAR/ZIP) files inside the NZB. |
560 | - if (! $bookFlood && $this->_NZBHasCompressedFile) { |
|
560 | + if (!$bookFlood && $this->_NZBHasCompressedFile) { |
|
561 | 561 | // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB. |
562 | 562 | $this->_processNZBCompressedFiles(); |
563 | 563 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $this->_processNZBCompressedFiles(true); |
567 | 567 | } |
568 | 568 | |
569 | - if (! $this->_releaseHasPassword) { |
|
569 | + if (!$this->_releaseHasPassword) { |
|
570 | 570 | // Process the extracted files to get video/audio samples/etc. |
571 | 571 | $this->_processExtractedFiles(); |
572 | 572 | } |
@@ -611,10 +611,10 @@ discard block |
||
611 | 611 | { |
612 | 612 | // Per release defaults. |
613 | 613 | $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/'; |
614 | - if (! File::isDirectory($this->tmpPath)) { |
|
615 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
614 | + if (!File::isDirectory($this->tmpPath)) { |
|
615 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
616 | 616 | // We will try to create the main temp folder again, just in case there was a file lock or filesystem issue. |
617 | - if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) { |
|
617 | + if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) { |
|
618 | 618 | $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning'); |
619 | 619 | |
620 | 620 | return false; |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $nzbPath = $this->_nzb->NZBPath($this->_release->guid); |
637 | 637 | if ($nzbPath !== false) { |
638 | 638 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
639 | - if (! $nzbContents) { |
|
639 | + if (!$nzbContents) { |
|
640 | 640 | if ($this->_echoCLI) { |
641 | 641 | $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning'); |
642 | 642 | } |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | } |
698 | 698 | |
699 | 699 | // Check if it's a rar/zip. |
700 | - if (! $this->_NZBHasCompressedFile && |
|
700 | + if (!$this->_NZBHasCompressedFile && |
|
701 | 701 | preg_match( |
702 | 702 | '/\.(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', |
703 | 703 | $this->_currentNZBFile['title'] |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | // Look for a video sample, make sure it's not an image. |
710 | - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
710 | + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) |
|
711 | 711 | ) { |
712 | 712 | // Get the amount of segments for this file. |
713 | 713 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | } |
722 | 722 | |
723 | 723 | // Look for a JPG picture, make sure it's not a CD cover. |
724 | - 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']) |
|
724 | + 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']) |
|
725 | 725 | ) { |
726 | 726 | // Get the amount of segments for this file. |
727 | 727 | $segCount = (\count($this->_currentNZBFile['segments']) - 1); |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $this->_reverse = $reverse; |
774 | 774 | |
775 | 775 | if ($this->_reverse) { |
776 | - if (! krsort($this->_nzbContents)) { |
|
776 | + if (!krsort($this->_nzbContents)) { |
|
777 | 777 | return; |
778 | 778 | } |
779 | 779 | } else { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | } |
798 | 798 | |
799 | 799 | // Probably not a rar/zip. |
800 | - if (! preg_match( |
|
800 | + if (!preg_match( |
|
801 | 801 | '/\.(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', |
802 | 802 | $nzbFile['title'] |
803 | 803 | ) |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | break; |
814 | 814 | } |
815 | 815 | $segment = (string) $nzbFile['segments'][$i]; |
816 | - if (! $this->_reverse) { |
|
816 | + if (!$this->_reverse) { |
|
817 | 817 | $this->_triedCompressedMids[] = $segment; |
818 | 818 | } elseif (\in_array($segment, $this->_triedCompressedMids, false)) { |
819 | 819 | // We already downloaded this file. |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | { |
866 | 866 | $this->_compressedFilesChecked++; |
867 | 867 | // Give the data to archive info so it can check if it's a rar. |
868 | - if (! $this->_archiveInfo->setData($compressedData, true)) { |
|
868 | + if (!$this->_archiveInfo->setData($compressedData, true)) { |
|
869 | 869 | if (config('app.debug') === true) { |
870 | 870 | $this->_debug('Data is probably not RAR or ZIP.'); |
871 | 871 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | } |
896 | 896 | |
897 | 897 | // Check if the compressed file is encrypted. |
898 | - if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
898 | + if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) { |
|
899 | 899 | if (config('app.debug') === true) { |
900 | 900 | $this->_debug('ArchiveInfo: Compressed file has a password.'); |
901 | 901 | } |
@@ -907,13 +907,13 @@ discard block |
||
907 | 907 | |
908 | 908 | if ($this->_reverse) { |
909 | 909 | $fileData = $dataSummary['file_list'] ?? []; |
910 | - if (! empty($fileData)) { |
|
910 | + if (!empty($fileData)) { |
|
911 | 911 | $rarFileName = Arr::pluck($fileData, 'name'); |
912 | 912 | if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) { |
913 | 913 | $preCheck = Predb::whereTitle($hit[0])->first(); |
914 | 914 | $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0; |
915 | 915 | (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid); |
916 | - } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
916 | + } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
917 | 917 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
918 | 918 | $archiveFileName = Arr::pluck($archiveData, 'name'); |
919 | 919 | if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) { |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | $this->_echo('r', 'primaryOver'); |
932 | 932 | } |
933 | 933 | |
934 | - if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
934 | + if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) { |
|
935 | 935 | $fileName = $this->tmpPath.uniqid('', true).'.rar'; |
936 | 936 | File::put($fileName, $compressedData); |
937 | 937 | runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"'); |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | $this->_echo('7z', 'primaryOver'); |
944 | 944 | } |
945 | 945 | |
946 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
946 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
947 | 947 | $fileName = $this->tmpPath.uniqid('', true).'.7z'; |
948 | 948 | File::put($fileName, $compressedData); |
949 | 949 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $this->_echo('z', 'primaryOver'); |
957 | 957 | } |
958 | 958 | |
959 | - if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { |
|
959 | + if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) { |
|
960 | 960 | $fileName = $this->tmpPath.uniqid('', true).'.zip'; |
961 | 961 | File::put($fileName, $compressedData); |
962 | 962 | // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | { |
982 | 982 | // Get a list of files inside the Compressed file. |
983 | 983 | $files = $this->_archiveInfo->getArchiveFileList(); |
984 | - if (! \is_array($files) || \count($files) === 0) { |
|
984 | + if (!\is_array($files) || \count($files) === 0) { |
|
985 | 985 | return false; |
986 | 986 | } |
987 | 987 | |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | protected function _addFileInfo(&$file): void |
1052 | 1052 | { |
1053 | 1053 | // Don't add rar/zip files to the DB. |
1054 | - if (! isset($file['error']) && isset($file['source']) && |
|
1055 | - ! 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']) |
|
1054 | + if (!isset($file['error']) && isset($file['source']) && |
|
1055 | + !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']) |
|
1056 | 1056 | ) { |
1057 | 1057 | // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. |
1058 | 1058 | // This is so we don't download more RAR or ZIP files for no reason. |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | */ |
1064 | 1064 | if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { |
1065 | 1065 | $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); |
1066 | - if (! empty($addReleaseFiles)) { |
|
1066 | + if (!empty($addReleaseFiles)) { |
|
1067 | 1067 | $this->_addedFileInfo++; |
1068 | 1068 | |
1069 | 1069 | if ($this->_echoCLI) { |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | $this->_releaseHasPassword = true; |
1081 | 1081 | $this->_passwordStatus = Releases::PASSWD_RAR; |
1082 | 1082 | } //Run a PreDB filename check on insert to try and match the release |
1083 | - elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
1083 | + elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
1084 | 1084 | $this->_release['filename'] = $file['name']; |
1085 | 1085 | $this->_release['releases_id'] = $this->_release->id; |
1086 | 1086 | $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true); |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | // If we found no compressed files, break out. |
1129 | - if (! $foundCompressedFile) { |
|
1129 | + if (!$foundCompressedFile) { |
|
1130 | 1130 | break; |
1131 | 1131 | } |
1132 | 1132 | |
@@ -1148,39 +1148,39 @@ discard block |
||
1148 | 1148 | |
1149 | 1149 | if (File::isFile($file)) { |
1150 | 1150 | // Process PAR2 files. |
1151 | - if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1151 | + if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { |
|
1152 | 1152 | $this->_siftPAR2Info($file); |
1153 | 1153 | } // Process NFO files. |
1154 | 1154 | elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) { |
1155 | 1155 | $this->_processNfoFile($file); |
1156 | 1156 | } // Process audio files. |
1157 | - elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1157 | + elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) { |
|
1158 | 1158 | // Try to get audio sample/audio media info. |
1159 | 1159 | File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]); |
1160 | 1160 | $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]); |
1161 | 1161 | File::delete($this->tmpPath.'audiofile.'.$fileType[2]); |
1162 | 1162 | } // Process JPG files. |
1163 | - elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1163 | + elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) { |
|
1164 | 1164 | $this->_getJPGSample($file); |
1165 | 1165 | File::delete($file); |
1166 | 1166 | } // Video sample // video clip // video media info. |
1167 | - elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1167 | + elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) { |
|
1168 | 1168 | $this->_processVideoFile($file); |
1169 | 1169 | } // Check file's magic info. |
1170 | 1170 | else { |
1171 | 1171 | $output = Utility::fileInfo($file); |
1172 | - if (! empty($output)) { |
|
1172 | + if (!empty($output)) { |
|
1173 | 1173 | switch (true) { |
1174 | - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1174 | + case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output): |
|
1175 | 1175 | $this->_getJPGSample($file); |
1176 | 1176 | File::delete($file); |
1177 | 1177 | break; |
1178 | 1178 | |
1179 | - case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1179 | + case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): |
|
1180 | 1180 | $this->_processVideoFile($file); |
1181 | 1181 | break; |
1182 | 1182 | |
1183 | - case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1183 | + case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): |
|
1184 | 1184 | switch ($fileType[0]) { |
1185 | 1185 | case 'FLAC': |
1186 | 1186 | $fileType = 'FLAC'; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | File::delete($this->tmpPath.'audiofile.'.$fileType); |
1198 | 1198 | break; |
1199 | 1199 | |
1200 | - case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1200 | + case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0: |
|
1201 | 1201 | $this->_siftPAR2Info($file); |
1202 | 1202 | break; |
1203 | 1203 | } |
@@ -1233,8 +1233,8 @@ discard block |
||
1233 | 1233 | protected function _processSampleMessageIDs(): void |
1234 | 1234 | { |
1235 | 1235 | // Download and process sample image. |
1236 | - if (! $this->_foundSample || ! $this->_foundVideo) { |
|
1237 | - if (! empty($this->_sampleMessageIDs)) { |
|
1236 | + if (!$this->_foundSample || !$this->_foundVideo) { |
|
1237 | + if (!empty($this->_sampleMessageIDs)) { |
|
1238 | 1238 | // Download it from usenet. |
1239 | 1239 | $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); |
1240 | 1240 | if ($this->_nntp::isError($sampleBinary)) { |
@@ -1253,12 +1253,12 @@ discard block |
||
1253 | 1253 | File::put($fileLocation, $sampleBinary); |
1254 | 1254 | |
1255 | 1255 | // Try to get a sample picture. |
1256 | - if (! $this->_foundSample) { |
|
1256 | + if (!$this->_foundSample) { |
|
1257 | 1257 | $this->_foundSample = $this->_getSample($fileLocation); |
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | // Try to get a sample video. |
1261 | - if (! $this->_foundVideo) { |
|
1261 | + if (!$this->_foundVideo) { |
|
1262 | 1262 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1263 | 1263 | } |
1264 | 1264 | } |
@@ -1279,8 +1279,8 @@ discard block |
||
1279 | 1279 | protected function _processMediaInfoMessageIDs(): void |
1280 | 1280 | { |
1281 | 1281 | // Download and process mediainfo. Also try to get a sample if we didn't get one yet. |
1282 | - if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) { |
|
1283 | - if (! empty($this->_MediaInfoMessageIDs)) { |
|
1282 | + if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) { |
|
1283 | + if (!empty($this->_MediaInfoMessageIDs)) { |
|
1284 | 1284 | // Try to download it from usenet. |
1285 | 1285 | $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP); |
1286 | 1286 | if ($this->_nntp::isError($mediaBinary)) { |
@@ -1300,17 +1300,17 @@ discard block |
||
1300 | 1300 | File::put($fileLocation, $mediaBinary); |
1301 | 1301 | |
1302 | 1302 | // Try to get media info. |
1303 | - if (! $this->_foundMediaInfo) { |
|
1303 | + if (!$this->_foundMediaInfo) { |
|
1304 | 1304 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | // Try to get a sample picture. |
1308 | - if (! $this->_foundSample) { |
|
1308 | + if (!$this->_foundSample) { |
|
1309 | 1309 | $this->_foundSample = $this->_getSample($fileLocation); |
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | // Try to get a sample video. |
1313 | - if (! $this->_foundVideo) { |
|
1313 | + if (!$this->_foundVideo) { |
|
1314 | 1314 | $this->_foundVideo = $this->_getVideo($fileLocation); |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1331,8 +1331,8 @@ discard block |
||
1331 | 1331 | protected function _processAudioInfoMessageIDs(): void |
1332 | 1332 | { |
1333 | 1333 | // Download audio file, use media info to try to get the artist / album. |
1334 | - if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) { |
|
1335 | - if (! empty($this->_AudioInfoMessageIDs)) { |
|
1334 | + if (!$this->_foundAudioInfo || !$this->_foundAudioSample) { |
|
1335 | + if (!empty($this->_AudioInfoMessageIDs)) { |
|
1336 | 1336 | // Try to download it from usenet. |
1337 | 1337 | $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP); |
1338 | 1338 | if ($this->_nntp::isError($audioBinary)) { |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | protected function _processJPGMessageIDs(): void |
1368 | 1368 | { |
1369 | 1369 | // Download JPG file. |
1370 | - if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { |
|
1370 | + if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) { |
|
1371 | 1371 | // Try to download it. |
1372 | 1372 | $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); |
1373 | 1373 | if ($this->_nntp::isError($jpgBinary)) { |
@@ -1436,12 +1436,12 @@ discard block |
||
1436 | 1436 | $this->_passwordStatus = max([$this->_passwordStatus]); |
1437 | 1437 | |
1438 | 1438 | // Set the release to no password if password processing is off. |
1439 | - if (! $this->_processPasswords) { |
|
1439 | + if (!$this->_processPasswords) { |
|
1440 | 1440 | $this->_releaseHasPassword = false; |
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password. |
1444 | - if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1444 | + if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) { |
|
1445 | 1445 | $release = Release::query()->where('id', $this->_release->id); |
1446 | 1446 | $release->decrement('passwordstatus'); |
1447 | 1447 | $release->update( |
@@ -1499,19 +1499,19 @@ discard block |
||
1499 | 1499 | $retVal = $audVal = false; |
1500 | 1500 | |
1501 | 1501 | // Check if audio sample fetching is on. |
1502 | - if (! $this->_processAudioSample) { |
|
1502 | + if (!$this->_processAudioSample) { |
|
1503 | 1503 | $audVal = true; |
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | // Check if media info fetching is on. |
1507 | - if (! $this->_processAudioInfo) { |
|
1507 | + if (!$this->_processAudioInfo) { |
|
1508 | 1508 | $retVal = true; |
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first(); |
1512 | 1512 | |
1513 | 1513 | $musicParent = (string) Category::MUSIC_ROOT; |
1514 | - if ($rQuery === null || ! preg_match( |
|
1514 | + if ($rQuery === null || !preg_match( |
|
1515 | 1515 | sprintf( |
1516 | 1516 | '/%d\d{3}|%d|%d|%d/', |
1517 | 1517 | $musicParent[0], |
@@ -1527,7 +1527,7 @@ discard block |
||
1527 | 1527 | |
1528 | 1528 | if (File::isFile($fileLocation)) { |
1529 | 1529 | // Check if media info is enabled. |
1530 | - if (! $retVal) { |
|
1530 | + if (!$retVal) { |
|
1531 | 1531 | // Get the media info for the file. |
1532 | 1532 | try { |
1533 | 1533 | $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | $ext = strtoupper($fileExtension); |
1541 | 1541 | |
1542 | 1542 | // Form a new search name. |
1543 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1543 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
1544 | 1544 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
1545 | 1545 | } else { |
1546 | 1546 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | // Check if creating audio samples is enabled. |
1605 | - if (! $audVal) { |
|
1605 | + if (!$audVal) { |
|
1606 | 1606 | // File name to store audio file. |
1607 | 1607 | $audioFileName = ($this->_release->guid.'.ogg'); |
1608 | 1608 | |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | // Try to move the temp audio file. |
1627 | 1627 | $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1628 | 1628 | |
1629 | - if (! $renamed) { |
|
1629 | + if (!$renamed) { |
|
1630 | 1630 | // Try to copy it if it fails. |
1631 | 1631 | $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); |
1632 | 1632 | |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | File::delete($this->tmpPath.$audioFileName); |
1635 | 1635 | |
1636 | 1636 | // If it didn't copy continue. |
1637 | - if (! $copied) { |
|
1637 | + if (!$copied) { |
|
1638 | 1638 | return false; |
1639 | 1639 | } |
1640 | 1640 | } |
@@ -1686,7 +1686,7 @@ discard block |
||
1686 | 1686 | $time = $this->ffprobe->format($videoLocation)->get('duration'); |
1687 | 1687 | } |
1688 | 1688 | |
1689 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1689 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
1690 | 1690 | return ''; |
1691 | 1691 | } |
1692 | 1692 | |
@@ -1707,7 +1707,7 @@ discard block |
||
1707 | 1707 | */ |
1708 | 1708 | protected function _getSample(string $fileLocation): bool |
1709 | 1709 | { |
1710 | - if (! $this->_processThumbnails) { |
|
1710 | + if (!$this->_processThumbnails) { |
|
1711 | 1711 | return false; |
1712 | 1712 | } |
1713 | 1713 | |
@@ -1772,7 +1772,7 @@ discard block |
||
1772 | 1772 | */ |
1773 | 1773 | protected function _getVideo(string $fileLocation): bool |
1774 | 1774 | { |
1775 | - if (! $this->_processVideo) { |
|
1775 | + if (!$this->_processVideo) { |
|
1776 | 1776 | return false; |
1777 | 1777 | } |
1778 | 1778 | |
@@ -1827,7 +1827,7 @@ discard block |
||
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | // If longer than 60 or we could not get the video length, run the old way. |
1830 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1830 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
1831 | 1831 | try { |
1832 | 1832 | $video = $this->ffmpeg->open($fileLocation); |
1833 | 1833 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration)); |
@@ -1850,14 +1850,14 @@ discard block |
||
1850 | 1850 | |
1851 | 1851 | // Try to move the file to the new path. |
1852 | 1852 | // If we couldn't rename it, try to copy it. |
1853 | - if (! @File::move($fileName, $newFile)) { |
|
1853 | + if (!@File::move($fileName, $newFile)) { |
|
1854 | 1854 | $copied = @File::copy($fileName, $newFile); |
1855 | 1855 | |
1856 | 1856 | // Delete the old file. |
1857 | 1857 | File::delete($fileName); |
1858 | 1858 | |
1859 | 1859 | // If it didn't copy, continue. |
1860 | - if (! $copied) { |
|
1860 | + if (!$copied) { |
|
1861 | 1861 | return false; |
1862 | 1862 | } |
1863 | 1863 | } |
@@ -1883,7 +1883,7 @@ discard block |
||
1883 | 1883 | */ |
1884 | 1884 | protected function _getMediaInfo($fileLocation): bool |
1885 | 1885 | { |
1886 | - if (! $this->_processMediaInfo) { |
|
1886 | + if (!$this->_processMediaInfo) { |
|
1887 | 1887 | return false; |
1888 | 1888 | } |
1889 | 1889 | |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | $filesAdded = 0; |
1959 | 1959 | |
1960 | 1960 | foreach ($this->_par2Info->getFileList() as $file) { |
1961 | - if (! isset($file['name'])) { |
|
1961 | + if (!isset($file['name'])) { |
|
1962 | 1962 | continue; |
1963 | 1963 | } |
1964 | 1964 | |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | } |
1982 | 1982 | |
1983 | 1983 | // Try to get a new name. |
1984 | - if (! $foundName) { |
|
1984 | + if (!$foundName) { |
|
1985 | 1985 | $this->_release->textstring = $file['name']; |
1986 | 1986 | $this->_release->releases_id = $this->_release->id; |
1987 | 1987 | if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) { |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | protected function _processVideoFile($fileLocation): void |
2012 | 2012 | { |
2013 | 2013 | // Try to get a sample with it. |
2014 | - if (! $this->_foundSample) { |
|
2014 | + if (!$this->_foundSample) { |
|
2015 | 2015 | $this->_foundSample = $this->_getSample($fileLocation); |
2016 | 2016 | } |
2017 | 2017 | |
@@ -2019,12 +2019,12 @@ discard block |
||
2019 | 2019 | * Don't get it here if _sampleMessageIDs is empty |
2020 | 2020 | * or has 1 message-id (Saves downloading another part). |
2021 | 2021 | */ |
2022 | - if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
2022 | + if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) { |
|
2023 | 2023 | $this->_foundVideo = $this->_getVideo($fileLocation); |
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | // Try to get media info with it. |
2027 | - if (! $this->_foundMediaInfo) { |
|
2027 | + if (!$this->_foundMediaInfo) { |
|
2028 | 2028 | $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation); |
2029 | 2029 | } |
2030 | 2030 | } |
@@ -2046,24 +2046,24 @@ discard block |
||
2046 | 2046 | $bf = true; |
2047 | 2047 | } |
2048 | 2048 | |
2049 | - if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2049 | + if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) { |
|
2050 | 2050 | $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a); |
2051 | 2051 | $af = true; |
2052 | 2052 | } |
2053 | - if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2053 | + if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) { |
|
2054 | 2054 | $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b); |
2055 | 2055 | $bf = true; |
2056 | 2056 | } |
2057 | 2057 | |
2058 | - if (! $af && ! $bf) { |
|
2058 | + if (!$af && !$bf) { |
|
2059 | 2059 | return strnatcasecmp($a, $b); |
2060 | 2060 | } |
2061 | 2061 | |
2062 | - if (! $bf) { |
|
2062 | + if (!$bf) { |
|
2063 | 2063 | return -1; |
2064 | 2064 | } |
2065 | 2065 | |
2066 | - if (! $af) { |
|
2066 | + if (!$af) { |
|
2067 | 2067 | return 1; |
2068 | 2068 | } |
2069 | 2069 | |
@@ -2088,12 +2088,12 @@ discard block |
||
2088 | 2088 | protected function _resetReleaseStatus(): void |
2089 | 2089 | { |
2090 | 2090 | // Only process for samples, previews and images if not disabled. |
2091 | - $this->_foundVideo = ! $this->_processVideo; |
|
2092 | - $this->_foundMediaInfo = ! $this->_processMediaInfo; |
|
2093 | - $this->_foundAudioInfo = ! $this->_processAudioInfo; |
|
2094 | - $this->_foundAudioSample = ! $this->_processAudioSample; |
|
2095 | - $this->_foundJPGSample = ! $this->_processJPGSample; |
|
2096 | - $this->_foundSample = ! $this->_processThumbnails; |
|
2091 | + $this->_foundVideo = !$this->_processVideo; |
|
2092 | + $this->_foundMediaInfo = !$this->_processMediaInfo; |
|
2093 | + $this->_foundAudioInfo = !$this->_processAudioInfo; |
|
2094 | + $this->_foundAudioSample = !$this->_processAudioSample; |
|
2095 | + $this->_foundJPGSample = !$this->_processJPGSample; |
|
2096 | + $this->_foundSample = !$this->_processThumbnails; |
|
2097 | 2097 | $this->_foundPAR2Info = false; |
2098 | 2098 | |
2099 | 2099 | $this->_passwordStatus = Releases::PASSWD_NONE; |