@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $nzbContents = Utility::unzipGzipFile($nzbPath); |
| 36 | - if (! $nzbContents) { |
|
| 36 | + if (!$nzbContents) { |
|
| 37 | 37 | // Try repair on raw file contents |
| 38 | 38 | $nzbContents = $this->attemptRawRepair($nzbPath); |
| 39 | - if (! $nzbContents) { |
|
| 39 | + if (!$nzbContents) { |
|
| 40 | 40 | return ['contents' => [], 'error' => 'NZB is empty or broken for GUID: '.$guid]; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | try { |
| 69 | 69 | $rawFile = @File::get($nzbPath); |
| 70 | - if (! $rawFile) { |
|
| 70 | + if (!$rawFile) { |
|
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | $fixed = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $raw); |
| 97 | 97 | |
| 98 | 98 | // If missing opening <nzb ...> tag, wrap content |
| 99 | - if (! str_contains(strtolower($fixed), '<nzb')) { |
|
| 99 | + if (!str_contains(strtolower($fixed), '<nzb')) { |
|
| 100 | 100 | $fixed = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n".$fixed."\n</nzb>"; |
| 101 | 101 | } else { |
| 102 | 102 | // Ensure closing tag |
| 103 | - if (! preg_match('/<\/nzb>\s*$/i', $fixed)) { |
|
| 103 | + if (!preg_match('/<\/nzb>\s*$/i', $fixed)) { |
|
| 104 | 104 | $fixed .= "\n</nzb>"; |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Try to parse using libxml recovery |
| 109 | - $opts = LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_COMPACT | LIBXML_NONET | LIBXML_NOCDATA | LIBXML_PARSEHUGE; |
|
| 109 | + $opts = LIBXML_NOERROR|LIBXML_NOWARNING|LIBXML_COMPACT|LIBXML_NONET|LIBXML_NOCDATA|LIBXML_PARSEHUGE; |
|
| 110 | 110 | $prev = libxml_use_internal_errors(true); |
| 111 | 111 | $xml = simplexml_load_string($fixed, 'SimpleXMLElement', $opts); |
| 112 | 112 | $errors = libxml_get_errors(); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Compressed file detection |
| 189 | - if (! $result['hasCompressedFile'] && preg_match( |
|
| 189 | + if (!$result['hasCompressedFile'] && preg_match( |
|
| 190 | 190 | '/(\\.(part\\d+|[rz]\\d+|rar|0+|0*10?|zipr\\d{2,3}|zipx?|7z(?:\\.\\d{3})?|(?:tar\\.)?(?:gz|bz2|xz))("|\\s*\\.rar)*($|[ ")]|-])|"[a-f0-9]{32}\\.[1-9]\\d{1,2}".*\\(\\d+\\/\\d{2,}\\)$)/i', |
| 191 | 191 | $title |
| 192 | 192 | )) { |
@@ -194,23 +194,23 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Look for a video sample (not an image) |
| 197 | - if ($processThumbnails && empty($result['sampleMessageIDs']) && ! empty($segments) |
|
| 197 | + if ($processThumbnails && empty($result['sampleMessageIDs']) && !empty($segments) |
|
| 198 | 198 | && stripos($title, 'sample') !== false |
| 199 | - && ! preg_match('/\.jpe?g$/i', $title) |
|
| 199 | + && !preg_match('/\.jpe?g$/i', $title) |
|
| 200 | 200 | ) { |
| 201 | 201 | $result['sampleMessageIDs'] = $this->extractSegments($segments, $segmentsToDownload); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // Look for a JPG picture (not a CD cover) |
| 205 | - if ($processJPGSample && empty($result['jpgMessageIDs']) && ! empty($segments) |
|
| 206 | - && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $groupName) |
|
| 205 | + if ($processJPGSample && empty($result['jpgMessageIDs']) && !empty($segments) |
|
| 206 | + && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $groupName) |
|
| 207 | 207 | && preg_match('/\.jpe?g[. ")\]]/i', $title) |
| 208 | 208 | ) { |
| 209 | 209 | $result['jpgMessageIDs'] = $this->extractSegments($segments, $segmentsToDownload); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Look for a video file for MediaInfo (sample video) |
| 213 | - if ($processMediaInfo && empty($result['mediaInfoMessageID']) && ! empty($segments[0]) |
|
| 213 | + if ($processMediaInfo && empty($result['mediaInfoMessageID']) && !empty($segments[0]) |
|
| 214 | 214 | && stripos($title, 'sample') !== false |
| 215 | 215 | && preg_match('/'.$videoFileRegex.'[. ")\]]/i', $title) |
| 216 | 216 | ) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Look for an audio file |
| 221 | - if ($processAudioInfo && empty($result['audioInfoMessageID']) && ! empty($segments) |
|
| 221 | + if ($processAudioInfo && empty($result['audioInfoMessageID']) && !empty($segments) |
|
| 222 | 222 | && preg_match('/'.$audioFileRegex.'[. ")\]]/i', $title, $type) |
| 223 | 223 | ) { |
| 224 | 224 | $result['audioInfoExtension'] = $type[1]; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return false; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if (! isset($file['name'])) { |
|
| 58 | + if (!isset($file['name'])) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $file['crc32'] ?? '' |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - if (! empty($added)) { |
|
| 118 | + if (!empty($added)) { |
|
| 119 | 119 | $context->addedFileInfo++; |
| 120 | 120 | |
| 121 | 121 | // Check for codec spam |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | $context->releaseHasPassword = true; |
| 127 | 127 | $context->passwordStatus = Releases::PASSWD_RAR; |
| 128 | - } elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) { |
|
| 128 | + } elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) { |
|
| 129 | 129 | // Run PreDB filename check |
| 130 | 130 | $context->release['filename'] = $file['name']; |
| 131 | 131 | $context->release['releases_id'] = $context->release->id; |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | $passwordStatus = max([$context->passwordStatus]); |
| 177 | 177 | |
| 178 | 178 | // Set to no password if processing is off |
| 179 | - if (! $processPasswords) { |
|
| 179 | + if (!$processPasswords) { |
|
| 180 | 180 | $context->releaseHasPassword = false; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Update based on conditions |
| 184 | - if (! $context->releaseHasPassword && $context->nzbHasCompressedFile && $releaseFilesCount === 0) { |
|
| 184 | + if (!$context->releaseHasPassword && $context->nzbHasCompressedFile && $releaseFilesCount === 0) { |
|
| 185 | 185 | Release::query()->where('id', $context->release->id)->update($updateRows); |
| 186 | 186 | } else { |
| 187 | 187 | $updateRows['passwordstatus'] = $processPasswords ? $passwordStatus : Releases::PASSWD_NONE; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $filesAdded = 0; |
| 298 | 298 | |
| 299 | 299 | foreach ($par2Info->getFileList() as $file) { |
| 300 | - if (! isset($file['name'])) { |
|
| 300 | + if (!isset($file['name'])) { |
|
| 301 | 301 | continue; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | // Try to get a new name |
| 331 | - if (! $foundName) { |
|
| 331 | + if (!$foundName) { |
|
| 332 | 332 | $context->release->textstring = $file['name']; |
| 333 | 333 | $context->release->releases_id = $context->release->id; |
| 334 | 334 | if ($this->nameFixer->checkName($context->release, $this->config->echoCLI, 'PAR2, ', 1, 1)) { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } elseif ($this->config->debugMode) { |
| 407 | 407 | Log::debug('RarInfo: Ignored low-quality candidate "'.$candidate.'" from inner file name.'); |
| 408 | 408 | } |
| 409 | - } elseif (! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 409 | + } elseif (!empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) { |
|
| 410 | 410 | // Try nested archive |
| 411 | 411 | $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list']; |
| 412 | 412 | $archiveFileName = array_column($archiveData, 'name'); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $binary = $this->nntp->getMessagesByMessageID($messageIDs, $this->config->alternateNNTP); |
| 64 | 64 | |
| 65 | 65 | // Handle non-string or empty response as failure |
| 66 | - if (! is_string($binary) || $binary === '') { |
|
| 66 | + if (!is_string($binary) || $binary === '') { |
|
| 67 | 67 | $errorMessage = null; |
| 68 | 68 | |
| 69 | 69 | if (is_object($binary) && method_exists($binary, 'getMessage')) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $result = $this->downloadByMessageIDs($messageIDs, $groupName, $releaseId); |
| 173 | 173 | |
| 174 | - if (! $result['success'] && $this->config->debugMode) { |
|
| 174 | + if (!$result['success'] && $this->config->debugMode) { |
|
| 175 | 175 | Log::debug('Compressed fetch failed', [ |
| 176 | 176 | 'release_id' => $releaseId, |
| 177 | 177 | 'file_title' => $fileTitle, |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | $sqlParts[] = 'AND r.size > ?'; |
| 127 | 127 | $bindings[] = $this->config->minSizeMB * 1048576; |
| 128 | 128 | } |
| 129 | - if (! empty($groupID)) { |
|
| 129 | + if (!empty($groupID)) { |
|
| 130 | 130 | $sqlParts[] = 'AND r.groups_id = ?'; |
| 131 | 131 | $bindings[] = $groupID; |
| 132 | 132 | } |
| 133 | - if (! empty($guidChar)) { |
|
| 133 | + if (!empty($guidChar)) { |
|
| 134 | 134 | $sqlParts[] = 'AND r.leftguid = ?'; |
| 135 | 135 | $bindings[] = $guidChar; |
| 136 | 136 | } |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | $this->processMessageIDDownloads($context); |
| 213 | 213 | |
| 214 | 214 | // Process compressed files |
| 215 | - if (! $bookFlood && $context->nzbHasCompressedFile) { |
|
| 215 | + if (!$bookFlood && $context->nzbHasCompressedFile) { |
|
| 216 | 216 | $this->processNZBCompressedFiles($context, false); |
| 217 | 217 | |
| 218 | 218 | if ($this->config->fetchLastFiles) { |
| 219 | 219 | $this->processNZBCompressedFiles($context, true); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if (! $context->releaseHasPassword) { |
|
| 222 | + if (!$context->releaseHasPassword) { |
|
| 223 | 223 | $this->processExtractedFiles($context); |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | private function processMessageIDDownloads(ReleaseProcessingContext $context): void |
| 264 | 264 | { |
| 265 | 265 | // Sample download |
| 266 | - if ((! $context->foundSample || ! $context->foundVideo) && ! empty($context->sampleMessageIDs)) { |
|
| 266 | + if ((!$context->foundSample || !$context->foundVideo) && !empty($context->sampleMessageIDs)) { |
|
| 267 | 267 | $result = $this->downloadService->downloadSample( |
| 268 | 268 | $context->sampleMessageIDs, |
| 269 | 269 | $context->releaseGroupName, |
@@ -275,26 +275,26 @@ discard block |
||
| 275 | 275 | $fileLocation = $context->tmpPath.'sample_'.random_int(0, 99999).'.avi'; |
| 276 | 276 | File::put($fileLocation, $result['data']); |
| 277 | 277 | |
| 278 | - if (! $context->foundSample) { |
|
| 278 | + if (!$context->foundSample) { |
|
| 279 | 279 | if ($this->mediaService->getSample($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 280 | 280 | $context->foundSample = true; |
| 281 | 281 | $this->output->echoSampleCreated(); |
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | - if (! $context->foundVideo) { |
|
| 284 | + if (!$context->foundVideo) { |
|
| 285 | 285 | if ($this->mediaService->getVideo($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 286 | 286 | $context->foundVideo = true; |
| 287 | 287 | $this->output->echoVideoCreated(); |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | - } elseif (! $result['success']) { |
|
| 290 | + } elseif (!$result['success']) { |
|
| 291 | 291 | $this->output->echoSampleFailure(); |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // Media info download |
| 296 | - if ((! $context->foundMediaInfo || ! $context->foundSample || ! $context->foundVideo) |
|
| 297 | - && ! empty($context->mediaInfoMessageIDs) |
|
| 296 | + if ((!$context->foundMediaInfo || !$context->foundSample || !$context->foundVideo) |
|
| 297 | + && !empty($context->mediaInfoMessageIDs) |
|
| 298 | 298 | ) { |
| 299 | 299 | $result = $this->downloadService->downloadMediaInfo( |
| 300 | 300 | $context->mediaInfoMessageIDs, |
@@ -307,32 +307,32 @@ discard block |
||
| 307 | 307 | $fileLocation = $context->tmpPath.'media.avi'; |
| 308 | 308 | File::put($fileLocation, $result['data']); |
| 309 | 309 | |
| 310 | - if (! $context->foundMediaInfo) { |
|
| 310 | + if (!$context->foundMediaInfo) { |
|
| 311 | 311 | if ($this->mediaService->getMediaInfo($fileLocation, $context->release->id)) { |
| 312 | 312 | $context->foundMediaInfo = true; |
| 313 | 313 | $this->output->echoMediaInfoAdded(); |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | - if (! $context->foundSample) { |
|
| 316 | + if (!$context->foundSample) { |
|
| 317 | 317 | if ($this->mediaService->getSample($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 318 | 318 | $context->foundSample = true; |
| 319 | 319 | $this->output->echoSampleCreated(); |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | - if (! $context->foundVideo) { |
|
| 322 | + if (!$context->foundVideo) { |
|
| 323 | 323 | if ($this->mediaService->getVideo($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 324 | 324 | $context->foundVideo = true; |
| 325 | 325 | $this->output->echoVideoCreated(); |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | - } elseif (! $result['success']) { |
|
| 328 | + } elseif (!$result['success']) { |
|
| 329 | 329 | $this->output->echoMediaInfoFailure(); |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // Audio info download |
| 334 | - if ((! $context->foundAudioInfo || ! $context->foundAudioSample) |
|
| 335 | - && ! empty($context->audioInfoMessageIDs) |
|
| 334 | + if ((!$context->foundAudioInfo || !$context->foundAudioSample) |
|
| 335 | + && !empty($context->audioInfoMessageIDs) |
|
| 336 | 336 | ) { |
| 337 | 337 | $result = $this->downloadService->downloadAudio( |
| 338 | 338 | $context->audioInfoMessageIDs, |
@@ -358,13 +358,13 @@ discard block |
||
| 358 | 358 | if ($audioResult['audioSample']) { |
| 359 | 359 | $this->output->echoAudioSampleCreated(); |
| 360 | 360 | } |
| 361 | - } elseif (! $result['success']) { |
|
| 361 | + } elseif (!$result['success']) { |
|
| 362 | 362 | $this->output->echoAudioFailure(); |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // JPG download |
| 367 | - if (! $context->foundJPGSample && ! empty($context->jpgMessageIDs)) { |
|
| 367 | + if (!$context->foundJPGSample && !empty($context->jpgMessageIDs)) { |
|
| 368 | 368 | $result = $this->downloadService->downloadJPG( |
| 369 | 369 | $context->jpgMessageIDs, |
| 370 | 370 | $context->releaseGroupName, |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | File::delete($fileLocation); |
| 386 | - } elseif (! $result['success']) { |
|
| 386 | + } elseif (!$result['success']) { |
|
| 387 | 387 | $this->output->echoJpgFailure(); |
| 388 | 388 | } |
| 389 | 389 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | $title = $nzbFile['title'] ?? ''; |
| 422 | - if (! preg_match( |
|
| 422 | + if (!preg_match( |
|
| 423 | 423 | '/(\\.(part\\d+|[rz]\\d+|rar|0+|0*10?|zipr\\d{2,3}|zipx?|7z(?:\\.\\d{3})?|(?:tar\\.)?(?:gz|bz2|xz))(\\s*\\.rar)*($|[ ")]|-])|"[a-f0-9]{32}\\.[1-9]\\d{1,2}".*\\(\\d+\\/\\d{2,}\\)$)/i', |
| 424 | 424 | $title |
| 425 | 425 | )) { |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | break; |
| 437 | 437 | } |
| 438 | 438 | $segment = (string) $segments[$i]; |
| 439 | - if (! $reverse) { |
|
| 439 | + if (!$reverse) { |
|
| 440 | 440 | $this->triedCompressedMids[] = $segment; |
| 441 | 441 | } elseif (in_array($segment, $this->triedCompressedMids, false)) { |
| 442 | 442 | continue 2; |
@@ -504,19 +504,19 @@ discard block |
||
| 504 | 504 | $fileLocation = $context->tmpPath.'inline_video_'.uniqid('', true).'.'.$ext; |
| 505 | 505 | File::put($fileLocation, $result['standaloneVideoData']); |
| 506 | 506 | |
| 507 | - if (! $context->foundMediaInfo) { |
|
| 507 | + if (!$context->foundMediaInfo) { |
|
| 508 | 508 | if ($this->mediaService->getMediaInfo($fileLocation, $context->release->id)) { |
| 509 | 509 | $context->foundMediaInfo = true; |
| 510 | 510 | $this->output->echoMediaInfoAdded(); |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | - if (! $context->foundSample) { |
|
| 513 | + if (!$context->foundSample) { |
|
| 514 | 514 | if ($this->mediaService->getSample($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 515 | 515 | $context->foundSample = true; |
| 516 | 516 | $this->output->echoSampleCreated(); |
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | - if (! $context->foundVideo) { |
|
| 519 | + if (!$context->foundVideo) { |
|
| 520 | 520 | if ($this->mediaService->getVideo($fileLocation, $context->tmpPath, $context->release->guid)) { |
| 521 | 521 | $context->foundVideo = true; |
| 522 | 522 | $this->output->echoVideoCreated(); |
@@ -526,17 +526,17 @@ discard block |
||
| 526 | 526 | return $context->foundMediaInfo || $context->foundSample || $context->foundVideo; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - if (! $result['success']) { |
|
| 529 | + if (!$result['success']) { |
|
| 530 | 530 | return false; |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | // Echo archive marker |
| 534 | - if (! empty($result['archiveMarker'])) { |
|
| 534 | + if (!empty($result['archiveMarker'])) { |
|
| 535 | 535 | $this->output->echoArchiveMarker($result['archiveMarker']); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | // Handle reverse processing for release name extraction |
| 539 | - if ($reverse && ! empty($result['dataSummary'])) { |
|
| 539 | + if ($reverse && !empty($result['dataSummary'])) { |
|
| 540 | 540 | $this->releaseManager->processReleaseNameFromRar($result['dataSummary'], $context); |
| 541 | 541 | } |
| 542 | 542 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $filePath = is_array($file) ? $file[0] : $file->getPathname(); |
| 585 | 585 | if (File::isFile($filePath)) { |
| 586 | 586 | $rarData = @File::get($filePath); |
| 587 | - if (! empty($rarData)) { |
|
| 587 | + if (!empty($rarData)) { |
|
| 588 | 588 | $this->processCompressedData($rarData, $context, false); |
| 589 | 589 | $foundCompressed = true; |
| 590 | 590 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - if (! $foundCompressed) { |
|
| 595 | + if (!$foundCompressed) { |
|
| 596 | 596 | break; |
| 597 | 597 | } |
| 598 | 598 | $nestedLevels++; |
@@ -612,12 +612,12 @@ discard block |
||
| 612 | 612 | continue; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if (! File::isFile($filePath)) { |
|
| 615 | + if (!File::isFile($filePath)) { |
|
| 616 | 616 | continue; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | // PAR2 files |
| 620 | - if (! $context->foundPAR2Info && preg_match('/\.par2$/i', $filePath)) { |
|
| 620 | + if (!$context->foundPAR2Info && preg_match('/\.par2$/i', $filePath)) { |
|
| 621 | 621 | $this->releaseManager->processPar2File( |
| 622 | 622 | $filePath, |
| 623 | 623 | $context, |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | // Audio files |
| 638 | - if ((! $context->foundAudioInfo || ! $context->foundAudioSample) |
|
| 638 | + if ((!$context->foundAudioInfo || !$context->foundAudioSample) |
|
| 639 | 639 | && preg_match('/(.*)'.$this->config->audioFileRegex.'$/i', $filePath, $fileType) |
| 640 | 640 | ) { |
| 641 | 641 | $audioPath = $context->tmpPath.'audiofile.'.$fileType[2]; |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | // JPG files |
| 660 | - if (! $context->foundJPGSample && preg_match('/\.jpe?g$/i', $filePath)) { |
|
| 660 | + if (!$context->foundJPGSample && preg_match('/\.jpe?g$/i', $filePath)) { |
|
| 661 | 661 | if ($this->mediaService->getJPGSample($filePath, $context->release->guid)) { |
| 662 | 662 | $context->foundJPGSample = true; |
| 663 | 663 | $this->output->echoJpgSaved(); |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | // Video files |
| 670 | - if ((! $context->foundSample || ! $context->foundVideo || ! $context->foundMediaInfo) |
|
| 670 | + if ((!$context->foundSample || !$context->foundVideo || !$context->foundMediaInfo) |
|
| 671 | 671 | && preg_match('/(.*)'.$this->config->videoFileRegex.'$/i', $filePath) |
| 672 | 672 | ) { |
| 673 | 673 | $this->mediaService->processVideoFile($filePath, $context, $context->tmpPath); |
@@ -680,17 +680,17 @@ discard block |
||
| 680 | 680 | continue; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - if (! $context->foundJPGSample && preg_match('/^JPE?G/i', $output)) { |
|
| 683 | + if (!$context->foundJPGSample && preg_match('/^JPE?G/i', $output)) { |
|
| 684 | 684 | if ($this->mediaService->getJPGSample($filePath, $context->release->guid)) { |
| 685 | 685 | $context->foundJPGSample = true; |
| 686 | 686 | $this->output->echoJpgSaved(); |
| 687 | 687 | } |
| 688 | 688 | File::delete($filePath); |
| 689 | - } elseif ((! $context->foundMediaInfo || ! $context->foundSample || ! $context->foundVideo) |
|
| 689 | + } elseif ((!$context->foundMediaInfo || !$context->foundSample || !$context->foundVideo) |
|
| 690 | 690 | && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output) |
| 691 | 691 | ) { |
| 692 | 692 | $this->mediaService->processVideoFile($filePath, $context, $context->tmpPath); |
| 693 | - } elseif ((! $context->foundAudioSample || ! $context->foundAudioInfo) |
|
| 693 | + } elseif ((!$context->foundAudioSample || !$context->foundAudioInfo) |
|
| 694 | 694 | && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $audioType) |
| 695 | 695 | ) { |
| 696 | 696 | $ext = match ($audioType[0]) { |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $this->output->echoAudioSampleCreated(); |
| 710 | 710 | } |
| 711 | 711 | File::delete($audioPath); |
| 712 | - } elseif (! $context->foundPAR2Info && stripos($output, 'Parity') === 0) { |
|
| 712 | + } elseif (!$context->foundPAR2Info && stripos($output, 'Parity') === 0) { |
|
| 713 | 713 | $this->releaseManager->processPar2File( |
| 714 | 714 | $filePath, |
| 715 | 715 | $context, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->addPAR2Files = (bool) config('nntmux_settings.add_par2'); |
| 72 | 72 | $this->ffmpegPath = config('nntmux_settings.ffmpeg_path') ?: false; |
| 73 | 73 | $this->mediaInfoPath = config('nntmux_settings.mediainfo_path') ?: false; |
| 74 | - if (! $this->ffmpegPath) { |
|
| 74 | + if (!$this->ffmpegPath) { |
|
| 75 | 75 | $this->processAudioSample = false; |
| 76 | 76 | $this->processThumbnails = false; |
| 77 | 77 | $this->processVideo = false; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $this->processMediaInfo = (bool) $this->mediaInfoPath; |
| 85 | 85 | $this->processAudioInfo = $this->processMediaInfo; |
| 86 | 86 | $this->processPasswords = config('nntmux_settings.check_passworded_rars') === true |
| 87 | - && ! empty(config('nntmux_settings.unrar_path')); |
|
| 87 | + && !empty(config('nntmux_settings.unrar_path')); |
|
| 88 | 88 | $this->audioSavePath = config('nntmux_settings.covers_path').'/audiosample/'; |
| 89 | 89 | $this->tmpUnrarPath = config('nntmux.tmp_unrar_path'); |
| 90 | 90 | $this->debugMode = (bool) config('app.debug'); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function getVideoTime(string $videoLocation): string |
| 49 | 49 | { |
| 50 | 50 | try { |
| 51 | - if (! $this->ffprobe()->isValid($videoLocation)) { |
|
| 51 | + if (!$this->ffprobe()->isValid($videoLocation)) { |
|
| 52 | 52 | return ''; |
| 53 | 53 | } |
| 54 | 54 | $time = $this->ffprobe()->format($videoLocation)->get('duration'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return ''; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 62 | + if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
|
| 63 | 63 | return ''; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function getSample(string $fileLocation, string $tmpPath, string $guid): bool |
| 80 | 80 | { |
| 81 | - if (! $this->config->processThumbnails || ! File::isFile($fileLocation)) { |
|
| 81 | + if (!$this->config->processThumbnails || !File::isFile($fileLocation)) { |
|
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if (! File::isFile($fileName)) { |
|
| 101 | + if (!File::isFile($fileName)) { |
|
| 102 | 102 | return false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function getVideo(string $fileLocation, string $tmpPath, string $guid): bool |
| 122 | 122 | { |
| 123 | - if (! $this->config->processVideo || ! File::isFile($fileLocation)) { |
|
| 123 | + if (!$this->config->processVideo || !File::isFile($fileLocation)) { |
|
| 124 | 124 | return false; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Fallback: use start of video |
| 168 | - if (! $newMethod) { |
|
| 168 | + if (!$newMethod) { |
|
| 169 | 169 | try { |
| 170 | 170 | if ($this->ffprobe()->isValid($fileLocation)) { |
| 171 | 171 | $video = $this->ffmpeg()->open($fileLocation); |
@@ -185,16 +185,16 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if (! File::isFile($fileName)) { |
|
| 188 | + if (!File::isFile($fileName)) { |
|
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $newFile = $this->releaseImage->vidSavePath.$guid.'.ogv'; |
| 193 | 193 | |
| 194 | - if (! @File::move($fileName, $newFile)) { |
|
| 194 | + if (!@File::move($fileName, $newFile)) { |
|
| 195 | 195 | $copied = @File::copy($fileName, $newFile); |
| 196 | 196 | File::delete($fileName); |
| 197 | - if (! $copied) { |
|
| 197 | + if (!$copied) { |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function getMediaInfo(string $fileLocation, int $releaseId): bool |
| 212 | 212 | { |
| 213 | - if (! $this->config->processMediaInfo || ! File::isFile($fileLocation)) { |
|
| 213 | + if (!$this->config->processMediaInfo || !File::isFile($fileLocation)) { |
|
| 214 | 214 | return false; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | ): array { |
| 260 | 260 | $result = ['audioInfo' => false, 'audioSample' => false]; |
| 261 | 261 | |
| 262 | - if (! $this->config->processAudioSample) { |
|
| 262 | + if (!$this->config->processAudioSample) { |
|
| 263 | 263 | $result['audioSample'] = true; |
| 264 | 264 | } |
| 265 | - if (! $this->config->processAudioInfo) { |
|
| 265 | + if (!$this->config->processAudioInfo) { |
|
| 266 | 266 | $result['audioInfo'] = true; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | ->first(); |
| 274 | 274 | |
| 275 | 275 | $musicParent = (string) Category::MUSIC_ROOT; |
| 276 | - if ($rQuery === null || ! preg_match( |
|
| 276 | + if ($rQuery === null || !preg_match( |
|
| 277 | 277 | sprintf( |
| 278 | 278 | '/%d\d{3}|%d|%d|%d/', |
| 279 | 279 | $musicParent[0], |
@@ -286,12 +286,12 @@ discard block |
||
| 286 | 286 | return $result; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if (! File::isFile($fileLocation)) { |
|
| 289 | + if (!File::isFile($fileLocation)) { |
|
| 290 | 290 | return $result; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Get media info |
| 294 | - if (! $result['audioInfo']) { |
|
| 294 | + if (!$result['audioInfo']) { |
|
| 295 | 295 | try { |
| 296 | 296 | $xmlArray = $this->mediaInfo()->getInfo($fileLocation, false); |
| 297 | 297 | if ($xmlArray !== null) { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $ext = strtoupper($fileExtension); |
| 302 | 302 | |
| 303 | 303 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName(); |
| 304 | - if (! empty($track->get('recorded_date')) |
|
| 304 | + if (!empty($track->get('recorded_date')) |
|
| 305 | 305 | && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname, $Year) |
| 306 | 306 | ) { |
| 307 | 307 | $newName .= ' ('.$Year[0].') '.$ext; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | // Create audio sample |
| 359 | - if (! $result['audioSample']) { |
|
| 359 | + if (!$result['audioSample']) { |
|
| 360 | 360 | $audioFileName = $context->release->guid.'.ogg'; |
| 361 | 361 | |
| 362 | 362 | try { |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | if (File::isFile($tmpPath.$audioFileName)) { |
| 376 | 376 | $renamed = File::move($tmpPath.$audioFileName, $this->config->audioSavePath.$audioFileName); |
| 377 | - if (! $renamed) { |
|
| 377 | + if (!$renamed) { |
|
| 378 | 378 | $copied = File::copy($tmpPath.$audioFileName, $this->config->audioSavePath.$audioFileName); |
| 379 | 379 | File::delete($tmpPath.$audioFileName); |
| 380 | - if (! $copied) { |
|
| 380 | + if (!$copied) { |
|
| 381 | 381 | return $result; |
| 382 | 382 | } |
| 383 | 383 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | 'mediaInfo' => false, |
| 407 | 407 | ]; |
| 408 | 408 | |
| 409 | - if (! $context->foundSample) { |
|
| 409 | + if (!$context->foundSample) { |
|
| 410 | 410 | $result['sample'] = $this->getSample($fileLocation, $tmpPath, $context->release->guid); |
| 411 | 411 | if ($result['sample']) { |
| 412 | 412 | $context->foundSample = true; |
@@ -414,14 +414,14 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | // Only get video if sampleMessageIDs count is less than 2 |
| 417 | - if (! $context->foundVideo && count($context->sampleMessageIDs) < 2) { |
|
| 417 | + if (!$context->foundVideo && count($context->sampleMessageIDs) < 2) { |
|
| 418 | 418 | $result['video'] = $this->getVideo($fileLocation, $tmpPath, $context->release->guid); |
| 419 | 419 | if ($result['video']) { |
| 420 | 420 | $context->foundVideo = true; |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if (! $context->foundMediaInfo) { |
|
| 424 | + if (!$context->foundMediaInfo) { |
|
| 425 | 425 | $result['mediaInfo'] = $this->getMediaInfo($fileLocation, $context->release->id); |
| 426 | 426 | if ($result['mediaInfo']) { |
| 427 | 427 | $context->foundMediaInfo = true; |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public function isJpegData(string $filePath): bool |
| 438 | 438 | { |
| 439 | - if (! File::isFile($filePath)) { |
|
| 439 | + if (!File::isFile($filePath)) { |
|
| 440 | 440 | return false; |
| 441 | 441 | } |
| 442 | 442 | return exif_imagetype($filePath) === IMAGETYPE_JPEG; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Try ArchiveInfo for RAR/ZIP |
| 74 | - if (! $this->archiveInfo->setData($compressedData, true)) { |
|
| 74 | + if (!$this->archiveInfo->setData($compressedData, true)) { |
|
| 75 | 75 | // Handle standalone video detection |
| 76 | 76 | $videoType = $this->detectStandaloneVideo($compressedData); |
| 77 | 77 | if ($videoType !== null) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Check for encryption |
| 107 | - if (! empty($this->archiveInfo->isEncrypted) |
|
| 107 | + if (!empty($this->archiveInfo->isEncrypted) |
|
| 108 | 108 | || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0) |
| 109 | 109 | ) { |
| 110 | 110 | if ($this->config->debugMode) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Get file list |
| 128 | 128 | $files = $this->archiveInfo->getArchiveFileList(); |
| 129 | - if (! is_array($files) || count($files) === 0) { |
|
| 129 | + if (!is_array($files) || count($files) === 0) { |
|
| 130 | 130 | return $result; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | 'passwordStatus' => Releases::PASSWD_NONE, |
| 208 | 208 | ]; |
| 209 | 209 | |
| 210 | - if (! $this->config->sevenZipPath) { |
|
| 210 | + if (!$this->config->sevenZipPath) { |
|
| 211 | 211 | return $result; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // Try listing with external 7z binary |
| 215 | 215 | $listed = $this->listSevenZipEntries($compressedData, $tmpPath); |
| 216 | - if (! empty($listed)) { |
|
| 217 | - if (! empty($listed[0]['__any_encrypted__'])) { |
|
| 216 | + if (!empty($listed)) { |
|
| 217 | + if (!empty($listed[0]['__any_encrypted__'])) { |
|
| 218 | 218 | return [ |
| 219 | 219 | 'success' => false, |
| 220 | 220 | 'files' => [], |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $files = $this->filterSevenZipFiles($listed); |
| 227 | - if (! empty($files)) { |
|
| 227 | + if (!empty($files)) { |
|
| 228 | 228 | return [ |
| 229 | 229 | 'success' => true, |
| 230 | 230 | 'files' => $files, |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | // Fallback: scan for filenames in raw data |
| 239 | 239 | $scannedNames = $this->scanSevenZipFilenames($compressedData); |
| 240 | - if (! empty($scannedNames)) { |
|
| 240 | + if (!empty($scannedNames)) { |
|
| 241 | 241 | $files = array_map(fn($name) => [ |
| 242 | 242 | 'name' => $name, |
| 243 | 243 | 'size' => 0, |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function listSevenZipEntries(string $compressedData, string $tmpPath): array |
| 266 | 266 | { |
| 267 | - if (! $this->config->sevenZipPath) { |
|
| 267 | + if (!$this->config->sevenZipPath) { |
|
| 268 | 268 | return []; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $stderr = null; |
| 281 | 281 | $ok = $this->execCommand($cmd, $exitCode, $stdout, $stderr); |
| 282 | 282 | |
| 283 | - if (! $ok || $exitCode !== 0 || empty($stdout)) { |
|
| 283 | + if (!$ok || $exitCode !== 0 || empty($stdout)) { |
|
| 284 | 284 | // Try plain listing fallback |
| 285 | 285 | $plainResult = $this->listSevenZipPlain($tmpFile); |
| 286 | 286 | File::delete($tmpFile); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $stderr = null; |
| 309 | 309 | $ok = $this->execCommand($cmd, $exitCode, $stdout, $stderr); |
| 310 | 310 | |
| 311 | - if (! $ok || $exitCode !== 0 || empty($stdout)) { |
|
| 311 | + if (!$ok || $exitCode !== 0 || empty($stdout)) { |
|
| 312 | 312 | return []; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $filtered = []; |
| 399 | 399 | |
| 400 | 400 | foreach ($files as $entry) { |
| 401 | - if (! empty($entry['__any_encrypted__'])) { |
|
| 401 | + if (!empty($entry['__any_encrypted__'])) { |
|
| 402 | 402 | continue; |
| 403 | 403 | } |
| 404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); |
| 411 | - if (! in_array($ext, $allowedExtensions, true)) { |
|
| 411 | + if (!in_array($ext, $allowedExtensions, true)) { |
|
| 412 | 412 | continue; |
| 413 | 413 | } |
| 414 | 414 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | $candidate = trim($candidate, " .-\t\n\r"); |
| 462 | 462 | $lower = strtolower($candidate); |
| 463 | - if (! isset($names[$lower])) { |
|
| 463 | + if (!isset($names[$lower])) { |
|
| 464 | 464 | $names[$lower] = $candidate; |
| 465 | 465 | if (count($names) >= 80) { |
| 466 | 466 | break; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | 'passwordStatus' => Releases::PASSWD_NONE, |
| 484 | 484 | ]; |
| 485 | 485 | |
| 486 | - if ($this->config->extractUsingRarInfo || ! $this->config->sevenZipPath) { |
|
| 486 | + if ($this->config->extractUsingRarInfo || !$this->config->sevenZipPath) { |
|
| 487 | 487 | return $result; |
| 488 | 488 | } |
| 489 | 489 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $marker = $markerMap[$type] ?? $type; |
| 495 | 495 | |
| 496 | 496 | $extractDir = $tmpPath.'un7z/'.uniqid('', true).'/'; |
| 497 | - if (! File::isDirectory($extractDir)) { |
|
| 497 | + if (!File::isDirectory($extractDir)) { |
|
| 498 | 498 | File::makeDirectory($extractDir, 0777, true, true); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | File::delete($fileName); |
| 525 | 525 | |
| 526 | - if (! empty($files)) { |
|
| 526 | + if (!empty($files)) { |
|
| 527 | 527 | return [ |
| 528 | 528 | 'success' => true, |
| 529 | 529 | 'files' => $this->filterExtractedFiles($files), |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | $name = $file['name'] ?? ''; |
| 554 | 554 | $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); |
| 555 | 555 | |
| 556 | - if (! in_array($ext, $allowedExtensions, true)) { |
|
| 556 | + if (!in_array($ext, $allowedExtensions, true)) { |
|
| 557 | 557 | continue; |
| 558 | 558 | } |
| 559 | 559 | |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | try { |
| 591 | 591 | if ($this->config->unrarPath) { |
| 592 | 592 | $unrarDir = $tmpPath.'unrar/'; |
| 593 | - if (! File::isDirectory($unrarDir)) { |
|
| 593 | + if (!File::isDirectory($unrarDir)) { |
|
| 594 | 594 | File::makeDirectory($unrarDir, 0777, true, true); |
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | $unzipDir = $tmpPath.'unzip/'; |
| 598 | - if (! File::isDirectory($unzipDir)) { |
|
| 598 | + if (!File::isDirectory($unzipDir)) { |
|
| 599 | 599 | File::makeDirectory($unzipDir, 0777, true, true); |
| 600 | 600 | } |
| 601 | 601 | } catch (\Throwable $e) { |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | switch ($dataSummary['main_type']) { |
| 616 | 616 | case ArchiveInfo::TYPE_RAR: |
| 617 | - if (! $this->config->extractUsingRarInfo && $this->config->unrarPath) { |
|
| 617 | + if (!$this->config->extractUsingRarInfo && $this->config->unrarPath) { |
|
| 618 | 618 | $fileName = $tmpPath.uniqid('', true).'.rar'; |
| 619 | 619 | File::put($fileName, $compressedData); |
| 620 | 620 | runCmd($killString.$this->config->unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$tmpPath.'unrar/"'); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | return 'r'; |
| 624 | 624 | |
| 625 | 625 | case ArchiveInfo::TYPE_ZIP: |
| 626 | - if (! $this->config->extractUsingRarInfo && $this->config->unzipPath) { |
|
| 626 | + if (!$this->config->extractUsingRarInfo && $this->config->unzipPath) { |
|
| 627 | 627 | $fileName = $tmpPath.uniqid('', true).'.zip'; |
| 628 | 628 | File::put($fileName, $compressedData); |
| 629 | 629 | runCmd($this->config->unzipPath.' -o "'.$fileName.'" -d "'.$tmpPath.'unzip/"'); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | if ($len >= 188 * 5) { |
| 663 | 663 | $isTs = true; |
| 664 | 664 | for ($i = 0; $i < 5; $i++) { |
| 665 | - if (! isset($data[188 * $i]) || $data[188 * $i] !== "\x47") { |
|
| 665 | + if (!isset($data[188 * $i]) || $data[188 * $i] !== "\x47") { |
|
| 666 | 666 | $isTs = false; |
| 667 | 667 | break; |
| 668 | 668 | } |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | ]; |
| 710 | 710 | |
| 711 | 711 | $process = @proc_open($cmd, $descriptorSpec, $pipes, null, null, ['bypass_shell' => true]); |
| 712 | - if (! is_resource($process)) { |
|
| 712 | + if (!is_resource($process)) { |
|
| 713 | 713 | $exitCode = -1; |
| 714 | 714 | return false; |
| 715 | 715 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | bool $processJPGSample, |
| 58 | 58 | bool $processThumbnails |
| 59 | 59 | ): void { |
| 60 | - $this->foundVideo = ! $processVideo; |
|
| 61 | - $this->foundMediaInfo = ! $processMediaInfo; |
|
| 62 | - $this->foundAudioInfo = ! $processAudioInfo; |
|
| 63 | - $this->foundAudioSample = ! $processAudioSample; |
|
| 64 | - $this->foundJPGSample = ! $processJPGSample; |
|
| 65 | - $this->foundSample = ! $processThumbnails; |
|
| 60 | + $this->foundVideo = !$processVideo; |
|
| 61 | + $this->foundMediaInfo = !$processMediaInfo; |
|
| 62 | + $this->foundAudioInfo = !$processAudioInfo; |
|
| 63 | + $this->foundAudioSample = !$processAudioSample; |
|
| 64 | + $this->foundJPGSample = !$processJPGSample; |
|
| 65 | + $this->foundSample = !$processThumbnails; |
|
| 66 | 66 | $this->foundPAR2Info = false; |
| 67 | 67 | } |
| 68 | 68 | /** |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function needsMediaProcessing(): bool |
| 105 | 105 | { |
| 106 | - return ! $this->foundVideo |
|
| 107 | - || ! $this->foundMediaInfo |
|
| 108 | - || ! $this->foundAudioInfo |
|
| 109 | - || ! $this->foundAudioSample; |
|
| 106 | + return !$this->foundVideo |
|
| 107 | + || !$this->foundMediaInfo |
|
| 108 | + || !$this->foundAudioInfo |
|
| 109 | + || !$this->foundAudioSample; |
|
| 110 | 110 | } |
| 111 | 111 | /** |
| 112 | 112 | * Check if any sample is still needed. |
| 113 | 113 | */ |
| 114 | 114 | public function needsSample(): bool |
| 115 | 115 | { |
| 116 | - return ! $this->foundSample || ! $this->foundJPGSample; |
|
| 116 | + return !$this->foundSample || !$this->foundJPGSample; |
|
| 117 | 117 | } |
| 118 | 118 | } |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | public function register(): void |
| 32 | 32 | { |
| 33 | 33 | // Configuration is a singleton since it loads settings once |
| 34 | - $this->app->singleton(ProcessingConfiguration::class, function () { |
|
| 34 | + $this->app->singleton(ProcessingConfiguration::class, function() { |
|
| 35 | 35 | return new ProcessingConfiguration(); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | 38 | // Console output service |
| 39 | - $this->app->singleton(ConsoleOutputService::class, function ($app) { |
|
| 39 | + $this->app->singleton(ConsoleOutputService::class, function($app) { |
|
| 40 | 40 | $config = $app->make(ProcessingConfiguration::class); |
| 41 | 41 | return new ConsoleOutputService($config->echoCLI); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | 44 | // NZB content parser |
| 45 | - $this->app->singleton(NzbContentParser::class, function ($app) { |
|
| 45 | + $this->app->singleton(NzbContentParser::class, function($app) { |
|
| 46 | 46 | $config = $app->make(ProcessingConfiguration::class); |
| 47 | 47 | return new NzbContentParser( |
| 48 | 48 | new NZB(), |
@@ -52,21 +52,21 @@ discard block |
||
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | 54 | // Archive extraction service |
| 55 | - $this->app->singleton(ArchiveExtractionService::class, function ($app) { |
|
| 55 | + $this->app->singleton(ArchiveExtractionService::class, function($app) { |
|
| 56 | 56 | return new ArchiveExtractionService( |
| 57 | 57 | $app->make(ProcessingConfiguration::class) |
| 58 | 58 | ); |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | // Usenet download service |
| 62 | - $this->app->singleton(UsenetDownloadService::class, function ($app) { |
|
| 62 | + $this->app->singleton(UsenetDownloadService::class, function($app) { |
|
| 63 | 63 | return new UsenetDownloadService( |
| 64 | 64 | $app->make(ProcessingConfiguration::class) |
| 65 | 65 | ); |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | 68 | // Release file manager |
| 69 | - $this->app->singleton(ReleaseFileManager::class, function ($app) { |
|
| 69 | + $this->app->singleton(ReleaseFileManager::class, function($app) { |
|
| 70 | 70 | return new ReleaseFileManager( |
| 71 | 71 | $app->make(ProcessingConfiguration::class), |
| 72 | 72 | new ReleaseExtra(), |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | 80 | // Media extraction service |
| 81 | - $this->app->singleton(MediaExtractionService::class, function ($app) { |
|
| 81 | + $this->app->singleton(MediaExtractionService::class, function($app) { |
|
| 82 | 82 | return new MediaExtractionService( |
| 83 | 83 | $app->make(ProcessingConfiguration::class), |
| 84 | 84 | new ReleaseImage(), |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | 90 | // Temp workspace service (might already be registered elsewhere) |
| 91 | - $this->app->singleton(TempWorkspaceService::class, function () { |
|
| 91 | + $this->app->singleton(TempWorkspaceService::class, function() { |
|
| 92 | 92 | return new TempWorkspaceService(); |
| 93 | 93 | }); |
| 94 | 94 | |
| 95 | 95 | // Main orchestrator |
| 96 | - $this->app->singleton(AdditionalProcessingOrchestrator::class, function ($app) { |
|
| 96 | + $this->app->singleton(AdditionalProcessingOrchestrator::class, function($app) { |
|
| 97 | 97 | return new AdditionalProcessingOrchestrator( |
| 98 | 98 | $app->make(ProcessingConfiguration::class), |
| 99 | 99 | $app->make(NzbContentParser::class), |