@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | break; |
| 80 | 80 | default: |
| 81 | 81 | throw new CpeSdk\CpeException("Unknown input asset 'type'! Abording ...", |
| 82 | - self::UNKOWN_INPUT_TYPE); |
|
| 82 | + self::UNKOWN_INPUT_TYPE); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Upload resulting file |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | // Open '$outputFilesPath' to read it and send all files to S3 bucket |
| 179 | 179 | if (!$handle = opendir($this->outputFilesPath)) { |
| 180 | 180 | throw new CpeSdk\CpeException("Can't open tmp path '$this->outputFilesPath'!", |
| 181 | - self::TMP_PATH_OPEN_FAIL); |
|
| 181 | + self::TMP_PATH_OPEN_FAIL); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Upload all resulting files sitting in $outputFilesPath to S3 |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | unlink("$this->outputFilesPath/$entry"); |
| 206 | 206 | |
| 207 | 207 | $this->cpeLogger->logOut("INFO", basename(__FILE__), |
| 208 | - $s3Output['msg'], |
|
| 209 | - $this->logKey); |
|
| 208 | + $s3Output['msg'], |
|
| 209 | + $this->logKey); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | private function getOutputPath($output) |
| 214 | 214 | { |
| 215 | 215 | $outputFilesPath = self::TMP_FOLDER |
| 216 | - . $this->name."/".$this->logKey; |
|
| 216 | + . $this->name."/".$this->logKey; |
|
| 217 | 217 | |
| 218 | 218 | $output->{'key'} = $output->{'path'}."/".$output->{'file'}; |
| 219 | 219 | |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | if ($this->debug) |
| 228 | 228 | $this->cpeLogger->logOut("INFO", basename(__FILE__), |
| 229 | - "Creating TMP output folder '".$outputFilesPath."'", |
|
| 230 | - $this->logKey); |
|
| 229 | + "Creating TMP output folder '".$outputFilesPath."'", |
|
| 230 | + $this->logKey); |
|
| 231 | 231 | |
| 232 | 232 | if (!mkdir($outputFilesPath, 0750, true)) |
| 233 | 233 | throw new CpeSdk\CpeException( |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | )) |
| 267 | 267 | { |
| 268 | 268 | throw new CpeSdk\CpeException("Can't convert that input asset 'type' (".$this->input->{'input_asset'}->{'type'}.") into this output asset 'type' (".$output->{'type'}.")! Abording.", |
| 269 | - self::CONVERSION_TYPE_ERROR); |
|
| 269 | + self::CONVERSION_TYPE_ERROR); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $cpeLogger = new SA\CpeSdk\CpeLogger($name, $logPath); |
| 352 | 352 | $cpeLogger->logOut("INFO", basename(__FILE__), |
| 353 | - "\033[1mStarting activity\033[0m: $name"); |
|
| 353 | + "\033[1mStarting activity\033[0m: $name"); |
|
| 354 | 354 | |
| 355 | 355 | // We instanciate the Activity 'ValidateAsset' and give it a name for Snf |
| 356 | 356 | $activityPoller = new TranscodeAssetActivity( |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | // Process options for watermark |
| 209 | 209 | if (isset($outputWanted->{'watermark'}) && $outputWanted->{'watermark'}) { |
| 210 | 210 | $watermarkOptions = |
| 211 | - $this->get_watermark_options( |
|
| 212 | - $tmpInputPath, |
|
| 213 | - $outputWanted->{'watermark'}); |
|
| 211 | + $this->get_watermark_options( |
|
| 212 | + $tmpInputPath, |
|
| 213 | + $outputWanted->{'watermark'}); |
|
| 214 | 214 | // Replace ${watermark_options} by watermark options |
| 215 | 215 | $ffmpegCmd = preg_replace('/\$\{watermark_options\}/', $watermarkOptions, $ffmpegCmd); |
| 216 | 216 | } |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | $formattedOptions = ""; |
| 264 | 264 | if (isset($outputWanted->{'preset_values'}->{'video_codec_options'})) { |
| 265 | 265 | $formattedOptions = |
| 266 | - $this->set_output_video_codec_options($outputWanted->{'preset_values'}->{'video_codec_options'}); |
|
| 266 | + $this->set_output_video_codec_options($outputWanted->{'preset_values'}->{'video_codec_options'}); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $watermarkOptions = ""; |
| 270 | 270 | // Process options for watermark |
| 271 | 271 | if (isset($outputWanted->{'watermark'}) && $outputWanted->{'watermark'}) { |
| 272 | 272 | $watermarkOptions = |
| 273 | - $this->get_watermark_options( |
|
| 274 | - $tmpInputPath, |
|
| 275 | - $outputWanted->{'watermark'}); |
|
| 273 | + $this->get_watermark_options( |
|
| 274 | + $tmpInputPath, |
|
| 275 | + $outputWanted->{'watermark'}); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // Create FFMpeg arguments |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $outputFilesPath .= "/" . $outputFileInfo['filename'] . "%06d." |
| 332 | - . $outputFileInfo['extension']; |
|
| 332 | + . $outputFileInfo['extension']; |
|
| 333 | 333 | $frameOptions = " -vf fps=fps=1/$intervals"; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | $watermarkPath); |
| 362 | 362 | |
| 363 | 363 | $this->cpeLogger->logOut("INFO", |
| 364 | - basename(__FILE__), |
|
| 365 | - $s3Output['msg'], |
|
| 366 | - $this->logKey); |
|
| 364 | + basename(__FILE__), |
|
| 365 | + $s3Output['msg'], |
|
| 366 | + $this->logKey); |
|
| 367 | 367 | |
| 368 | 368 | // Transform watermark for opacity |
| 369 | 369 | $convertCmd = "convert $watermarkPath -alpha on -channel A -evaluate Multiply " . $watermarkOptions->{'opacity'} . " +channel $newWatermarkPath"; |
@@ -550,12 +550,12 @@ discard block |
||
| 550 | 550 | { |
| 551 | 551 | if (!$output_wanted) { |
| 552 | 552 | throw new CpeSdk\CpeException("No output data provided to transcoder !", |
| 553 | - self::NO_OUTPUT); |
|
| 553 | + self::NO_OUTPUT); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | if (!isset($output_wanted->{"preset"})) { |
| 557 | 557 | throw new CpeSdk\CpeException("No preset selected for output !", |
| 558 | - self::BAD_PRESETS_DIR); |
|
| 558 | + self::BAD_PRESETS_DIR); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | $preset = $output_wanted->{"preset"}; |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if (!($presetContent = file_get_contents($presetPath.$preset.".json"))) { |
| 565 | 565 | throw new CpeSdk\CpeException("Can't open preset file !", |
| 566 | - self::OPEN_PRESET_FAILED); |
|
| 566 | + self::OPEN_PRESET_FAILED); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | if (!($decodedPreset = json_decode($presetContent))) { |
| 570 | 570 | throw new CpeSdk\CpeException("Bad preset JSON format !", |
| 571 | - self::BAD_PRESET_FORMAT); |
|
| 571 | + self::BAD_PRESET_FORMAT); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | return ($decodedPreset); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | { |
| 580 | 580 | if (!isset($output->{"preset"})) { |
| 581 | 581 | throw new CpeSdk\CpeException("No preset selected for output !", |
| 582 | - self::BAD_PRESETS_DIR); |
|
| 582 | + self::BAD_PRESETS_DIR); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | $preset = $output->{"preset"}; |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | if (!($files = scandir($presetPath))) { |
| 589 | 589 | throw new CpeSdk\CpeException("Unable to open preset directory '$presetPath' !", |
| 590 | - self::BAD_PRESETS_DIR); |
|
| 590 | + self::BAD_PRESETS_DIR); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | foreach ($files as $presetFile) |
@@ -600,12 +600,12 @@ discard block |
||
| 600 | 600 | { |
| 601 | 601 | if (!($presetContent = file_get_contents("$presetPath/$presetFile"))) { |
| 602 | 602 | throw new CpeSdk\CpeException("Can't open preset file '$presetPath/$presetFile'!", |
| 603 | - self::OPEN_PRESET_FAILED); |
|
| 603 | + self::OPEN_PRESET_FAILED); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if (!($decodedPreset = json_decode($presetContent))) { |
| 607 | 607 | throw new CpeSdk\CpeException("Bad preset JSON format '$presetPath/$presetFile'!", |
| 608 | - self::BAD_PRESET_FORMAT); |
|
| 608 | + self::BAD_PRESET_FORMAT); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | return true; |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | throw new CpeSdk\CpeException("Unkown preset file '$preset' !", |
| 617 | - self::UNKNOWN_PRESET); |
|
| 617 | + self::UNKNOWN_PRESET); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | // Extract Metadata from ffprobe |
@@ -237,7 +237,7 @@ |
||
| 237 | 237 | |
| 238 | 238 | $cpeLogger = new SA\CpeSdk\CpeLogger($name, $logPath); |
| 239 | 239 | $cpeLogger->logOut("INFO", basename(__FILE__), |
| 240 | - "\033[1mStarting activity\033[0m: $name"); |
|
| 240 | + "\033[1mStarting activity\033[0m: $name"); |
|
| 241 | 241 | |
| 242 | 242 | // We instanciate the Activity 'ValidateAsset' and give it a name for Snf |
| 243 | 243 | $activityPoller = new ValidateAssetActivity( |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | if ($this->debug) |
| 80 | 80 | $this->cpeLogger->logOut("DEBUG", basename(__FILE__), |
| 81 | - "Creating TMP input folder '".$this->tmpInputPath."'", |
|
| 82 | - $this->logKey); |
|
| 81 | + "Creating TMP input folder '".$this->tmpInputPath."'", |
|
| 82 | + $this->logKey); |
|
| 83 | 83 | |
| 84 | 84 | if (!mkdir($this->tmpInputPath, 0750, true)) |
| 85 | 85 | throw new CpeSdk\CpeException( |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | // Get file from S3 or local copy if any |
| 119 | 119 | $this->cpeLogger->logOut("INFO", |
| 120 | - basename(__FILE__), |
|
| 121 | - "Downloading '$inputBuket/$inputFile' to '$saveFileTo' ...", |
|
| 122 | - $this->logKey); |
|
| 120 | + basename(__FILE__), |
|
| 121 | + "Downloading '$inputBuket/$inputFile' to '$saveFileTo' ...", |
|
| 122 | + $this->logKey); |
|
| 123 | 123 | |
| 124 | 124 | // Use the S3 utils to initiate the download |
| 125 | 125 | $s3Output = $this->s3Utils->get_file_from_s3( |
@@ -132,12 +132,12 @@ discard block |
||
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | $this->cpeLogger->logOut("INFO", basename(__FILE__), |
| 135 | - $s3Output['msg'], |
|
| 136 | - $this->logKey); |
|
| 135 | + $s3Output['msg'], |
|
| 136 | + $this->logKey); |
|
| 137 | 137 | |
| 138 | 138 | $this->cpeLogger->logOut("INFO", basename(__FILE__), |
| 139 | - "Input file successfully downloaded into local TMP folder '$saveFileTo' !", |
|
| 140 | - $this->logKey); |
|
| 139 | + "Input file successfully downloaded into local TMP folder '$saveFileTo' !", |
|
| 140 | + $this->logKey); |
|
| 141 | 141 | |
| 142 | 142 | return $saveFileTo; |
| 143 | 143 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | filesize($options['to'])) |
| 38 | 38 | { |
| 39 | 39 | $out = [ "status" => "SUCCESS", |
| 40 | - "msg" => "[".__FILE__."] Using local copy: '" . $options['to'] . "'" ]; |
|
| 40 | + "msg" => "[".__FILE__."] Using local copy: '" . $options['to'] . "'" ]; |
|
| 41 | 41 | print json_encode($out)."\n"; |
| 42 | 42 | exit(0); |
| 43 | 43 | } |
@@ -60,6 +60,6 @@ discard block |
||
| 60 | 60 | )); |
| 61 | 61 | |
| 62 | 62 | $out = [ "status" => "SUCCESS", |
| 63 | - "msg" => "[".__FILE__."] Download '" . $options['bucket'] . "/" . $options['file'] . "' successful !" ]; |
|
| 63 | + "msg" => "[".__FILE__."] Download '" . $options['bucket'] . "/" . $options['file'] . "' successful !" ]; |
|
| 64 | 64 | |
| 65 | 65 | print json_encode($out)."\n"; |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | if (!($process = proc_open($cmd, $descriptors, $pipes)) || |
| 45 | 45 | !is_resource($process)) { |
| 46 | 46 | $this->cpeLogger->logOut("ERROR", |
| 47 | - basename(__FILE__), "Unable to execute command:\n$cmd", |
|
| 48 | - $this->logKey); |
|
| 47 | + basename(__FILE__), "Unable to execute command:\n$cmd", |
|
| 48 | + $this->logKey); |
|
| 49 | 49 | throw new CpeSdk\CpeException("Unable to execute command:\n$cmd\n", |
| 50 | - self::EXEC_FAILED); |
|
| 50 | + self::EXEC_FAILED); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Set the pipes as non-blocking |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Type 3: Object method call |
| 84 | 84 | if (isset($progressCallback) && $progressCallback) { |
| 85 | 85 | call_user_func($progressCallback, $progressCallbackParams, |
| 86 | - $allOut, $allOutErr); |
|
| 86 | + $allOut, $allOutErr); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $i = 0; |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | if ($procStatus['exitcode'] > 0) |
| 120 | 120 | { |
| 121 | 121 | $this->cpeLogger->logOut("ERROR", |
| 122 | - basename(__FILE__), |
|
| 123 | - "Can't execute: $cmd. Exit Code: ".$procStatus['exitcode'], |
|
| 124 | - $this->logKey); |
|
| 122 | + basename(__FILE__), |
|
| 123 | + "Can't execute: $cmd. Exit Code: ".$procStatus['exitcode'], |
|
| 124 | + $this->logKey); |
|
| 125 | 125 | if ($allOut) |
| 126 | 126 | $this->cpeLogger->logOut("ERROR", |
| 127 | - basename(__FILE__), "COMMAND STDOUT: ".$allOut, |
|
| 128 | - $this->logKey); |
|
| 127 | + basename(__FILE__), "COMMAND STDOUT: ".$allOut, |
|
| 128 | + $this->logKey); |
|
| 129 | 129 | if ($allOutErr) |
| 130 | 130 | $this->cpeLogger->logOut("ERROR", |
| 131 | - basename(__FILE__), "COMMAND STDERR: ".$allOutErr, |
|
| 132 | - $this->logKey); |
|
| 131 | + basename(__FILE__), "COMMAND STDERR: ".$allOutErr, |
|
| 132 | + $this->logKey); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($showProgress) { |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This class allows you to call the two S3 scripts |
| 4 | 4 | * to download and upload files. |
| 5 | 5 | * The scripts are executed using the CommandExecuter |
| 6 | - */ |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | require_once __DIR__ . '/CommandExecuter.php'; |
| 9 | 9 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $cmd, |
| 90 | 90 | 1, |
| 91 | 91 | array(1 => array("pipe", "w"), |
| 92 | - 2 => array("pipe", "w")), |
|
| 92 | + 2 => array("pipe", "w")), |
|
| 93 | 93 | $callback, |
| 94 | 94 | $callbackParams, |
| 95 | 95 | true, |