|
@@ -98,7 +98,7 @@ discard block |
|
|
block discarded – undo |
|
98
|
98
|
$subfolder = ''; |
|
99
|
99
|
|
|
100
|
100
|
// sub folder check |
|
101
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
101
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
102
|
102
|
$subfolder = $filePath->folderPath; |
|
103
|
103
|
} |
|
104
|
104
|
|
|
@@ -106,7 +106,7 @@ discard block |
|
|
block discarded – undo |
|
106
|
106
|
$filePath = $this->getAssetPath($filePath); |
|
107
|
107
|
|
|
108
|
108
|
if (!empty($filePath)) { |
|
109
|
|
- $destVideoPath = $settings['transcoderPaths']['video'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
109
|
+ $destVideoPath = $settings['transcoderPaths']['video'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
110
|
110
|
$destVideoPath = Craft::getAlias($destVideoPath); |
|
111
|
111
|
$videoOptions = $this->coalesceOptions('defaultVideoOptions', $videoOptions); |
|
112
|
112
|
|
|
@@ -198,7 +198,7 @@ discard block |
|
|
block discarded – undo |
|
198
|
198
|
|
|
199
|
199
|
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
200
|
200
|
if (file_exists($destVideoPath) && (@filemtime($destVideoPath) >= @filemtime($filePath))) { |
|
201
|
|
- $url = $settings['transcoderUrls']['video'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
201
|
+ $url = $settings['transcoderUrls']['video'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
202
|
202
|
$result = Craft::getAlias($url).$destVideoFile; |
|
203
|
203
|
|
|
204
|
204
|
// skip encoding |
|
@@ -235,14 +235,14 @@ discard block |
|
|
block discarded – undo |
|
235
|
235
|
$subfolder = ''; |
|
236
|
236
|
|
|
237
|
237
|
// sub folder check |
|
238
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
238
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
239
|
239
|
$subfolder = $filePath->folderPath; |
|
240
|
240
|
} |
|
241
|
241
|
|
|
242
|
242
|
$filePath = $this->getAssetPath($filePath); |
|
243
|
243
|
|
|
244
|
244
|
if (!empty($filePath)) { |
|
245
|
|
- $destThumbnailPath = $settings['transcoderPaths']['thumbnail'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
245
|
+ $destThumbnailPath = $settings['transcoderPaths']['thumbnail'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
246
|
246
|
$destThumbnailPath = Craft::getAlias($destThumbnailPath); |
|
247
|
247
|
|
|
248
|
248
|
$thumbnailOptions = $this->coalesceOptions('defaultThumbnailOptions', $thumbnailOptions); |
|
@@ -303,7 +303,7 @@ discard block |
|
|
block discarded – undo |
|
303
|
303
|
if ($asPath) { |
|
304
|
304
|
$result = $destThumbnailPath; |
|
305
|
305
|
} else { |
|
306
|
|
- $url = $settings['transcoderUrls']['thumbnail'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
306
|
+ $url = $settings['transcoderUrls']['thumbnail'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
307
|
307
|
$result = Craft::getAlias($url).$destThumbnailFile; |
|
308
|
308
|
} |
|
309
|
309
|
} |
|
@@ -327,14 +327,14 @@ discard block |
|
|
block discarded – undo |
|
327
|
327
|
$subfolder = ''; |
|
328
|
328
|
|
|
329
|
329
|
// sub folder check |
|
330
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
330
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
331
|
331
|
$subfolder = $filePath->folderPath; |
|
332
|
332
|
} |
|
333
|
333
|
|
|
334
|
334
|
$filePath = $this->getAssetPath($filePath); |
|
335
|
335
|
|
|
336
|
336
|
if (!empty($filePath)) { |
|
337
|
|
- $destAudioPath = $settings['transcoderPaths']['audio'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
337
|
+ $destAudioPath = $settings['transcoderPaths']['audio'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
338
|
338
|
$destAudioPath = Craft::getAlias($destAudioPath); |
|
339
|
339
|
|
|
340
|
340
|
$audioOptions = $this->coalesceOptions('defaultAudioOptions', $audioOptions); |
|
@@ -392,7 +392,7 @@ discard block |
|
|
block discarded – undo |
|
392
|
392
|
.' -y '.escapeshellarg($destAudioPath); |
|
393
|
393
|
|
|
394
|
394
|
if (!$audioOptions['synchronous']) { |
|
395
|
|
- $ffmpegCmd .=' 1> '.$progressFile.' 2>&1 & echo $!'; |
|
|
395
|
+ $ffmpegCmd .= ' 1> '.$progressFile.' 2>&1 & echo $!'; |
|
396
|
396
|
// Make sure there isn't a lockfile for this audio file already |
|
397
|
397
|
$lockFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$destAudioFile.'.lock'; |
|
398
|
398
|
$oldPid = @file_get_contents($lockFile); |
|
@@ -409,7 +409,7 @@ discard block |
|
|
block discarded – undo |
|
409
|
409
|
|
|
410
|
410
|
// If the audio file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
411
|
411
|
if (file_exists($destAudioPath) && (@filemtime($destAudioPath) >= @filemtime($filePath))) { |
|
412
|
|
- $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
412
|
+ $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
413
|
413
|
$result = Craft::getAlias($url).$destAudioFile; |
|
414
|
414
|
} else { |
|
415
|
415
|
// Kick off the transcoding |
|
@@ -417,7 +417,7 @@ discard block |
|
|
block discarded – undo |
|
417
|
417
|
|
|
418
|
418
|
if ($audioOptions['synchronous']) { |
|
419
|
419
|
Craft::info($ffmpegCmd, __METHOD__); |
|
420
|
|
- $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
420
|
+ $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
421
|
421
|
$result = Craft::getAlias($url).$destAudioFile; |
|
422
|
422
|
} else { |
|
423
|
423
|
Craft::info($ffmpegCmd."\nffmpeg PID: ".$pid, __METHOD__); |
|
@@ -492,7 +492,7 @@ discard block |
|
|
block discarded – undo |
|
492
|
492
|
&& (strpos($summaryResult['videoFrameRate'], '/') !== false) |
|
493
|
493
|
) { |
|
494
|
494
|
$parts = explode('/', $summaryResult['videoFrameRate']); |
|
495
|
|
- $summaryResult['videoFrameRate'] = (float)$parts[0] / (float)$parts[1]; |
|
|
495
|
+ $summaryResult['videoFrameRate'] = (float) $parts[0] / (float) $parts[1]; |
|
496
|
496
|
} |
|
497
|
497
|
$result = $summaryResult; |
|
498
|
498
|
} |
|
@@ -604,7 +604,7 @@ discard block |
|
|
block discarded – undo |
|
604
|
604
|
$subfolder = ''; |
|
605
|
605
|
|
|
606
|
606
|
// sub folder check |
|
607
|
|
- if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
|
607
|
+ if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) { |
|
608
|
608
|
$subfolder = $filePath->folderPath; |
|
609
|
609
|
} |
|
610
|
610
|
|
|
@@ -612,7 +612,7 @@ discard block |
|
|
block discarded – undo |
|
612
|
612
|
|
|
613
|
613
|
if (!empty($filePath)) { |
|
614
|
614
|
// Dest path |
|
615
|
|
- $destVideoPath = $settings['transcoderPaths']['gif'] . $subfolder ?? $settings['transcoderPaths']['default']; |
|
|
615
|
+ $destVideoPath = $settings['transcoderPaths']['gif'].$subfolder ?? $settings['transcoderPaths']['default']; |
|
616
|
616
|
$destVideoPath = Craft::getAlias($destVideoPath); |
|
617
|
617
|
|
|
618
|
618
|
// Options |
|
@@ -666,7 +666,7 @@ discard block |
|
|
block discarded – undo |
|
666
|
666
|
|
|
667
|
667
|
// If the video file already exists and hasn't been modified, return it. Otherwise, start it transcoding |
|
668
|
668
|
if (file_exists($destVideoPath) && (@filemtime($destVideoPath) >= @filemtime($filePath))) { |
|
669
|
|
- $url = $settings['transcoderUrls']['gif'] . $subfolder ?? $settings['transcoderUrls']['default']; |
|
|
669
|
+ $url = $settings['transcoderUrls']['gif'].$subfolder ?? $settings['transcoderUrls']['default']; |
|
670
|
670
|
$result = Craft::getAlias($url).$destVideoFile; |
|
671
|
671
|
} else { |
|
672
|
672
|
// Kick off the transcoding |
|
@@ -752,14 +752,14 @@ discard block |
|
|
block discarded – undo |
|
752
|
752
|
// If it's local, get a path to the file |
|
753
|
753
|
if ($assetVolume instanceof Local) { |
|
754
|
754
|
$sourcePath = rtrim($assetVolume->path, DIRECTORY_SEPARATOR); |
|
755
|
|
- $sourcePath .= '' === $sourcePath ? '': DIRECTORY_SEPARATOR; |
|
|
755
|
+ $sourcePath .= '' === $sourcePath ? '' : DIRECTORY_SEPARATOR; |
|
756
|
756
|
$folderPath = ''; |
|
757
|
757
|
try { |
|
758
|
758
|
$folderPath = rtrim($asset->getFolder()->path, DIRECTORY_SEPARATOR); |
|
759
|
759
|
} catch (InvalidConfigException $e) { |
|
760
|
760
|
Craft::error($e->getMessage(), __METHOD__); |
|
761
|
761
|
} |
|
762
|
|
- $folderPath .= '' === $folderPath ? '': DIRECTORY_SEPARATOR; |
|
|
762
|
+ $folderPath .= '' === $folderPath ? '' : DIRECTORY_SEPARATOR; |
|
763
|
763
|
|
|
764
|
764
|
$filePath = $sourcePath.$folderPath.$asset->filename; |
|
765
|
765
|
} else { |