Skip to content

Commit 3642cf7

Browse files
committed
Merge branch 'release/1.2.7' into v1
2 parents ac3526b + 09d1f48 commit 3642cf7

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Transcoder Changelog
22

3+
## 1.2.7 - 2019.11.12
4+
### Changed
5+
* Fixed issues with the `synchronous` and `stripMetadata` options
6+
37
## 1.2.6 - 2019.11.11
48
### Added
59
* Added trimming to audio transcoding

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nystudio107/craft-transcoder",
33
"description": "Transcode video & audio files to various formats, and provide video thumbnails",
44
"type": "craft-plugin",
5-
"version": "1.2.6",
5+
"version": "1.2.7",
66
"keywords": [
77
"craft",
88
"cms",

src/services/Transcode.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,24 @@ public function getAudioUrl($filePath, $audioOptions): string
386386

387387
// Assemble the destination path and final ffmpeg command
388388
$destAudioPath .= $destAudioFile;
389-
390-
if ($audioOptions['stripMetadata']) {
389+
// Handle the `stripMetadata` setting
390+
$stripMetadata = false;
391+
if (!empty($audioOptions['stripMetadata'])) {
392+
$stripMetadata = $audioOptions['stripMetadata'];
393+
}
394+
if ($stripMetadata) {
391395
$ffmpegCmd .= ' -map_metadata -1 ';
392396
}
393-
397+
// Add the file format
394398
$ffmpegCmd .= ' -f '
395399
.$thisEncoder['fileFormat']
396400
.' -y '.escapeshellarg($destAudioPath);
397-
398-
if (!$audioOptions['synchronous']) {
401+
// Handle the `synchronous` setting
402+
$synchronous = false;
403+
if (!empty($audioOptions['synchronous'])) {
404+
$synchronous = $audioOptions['synchronous'];
405+
}
406+
if (!$synchronous) {
399407
$ffmpegCmd .=' 1> '.$progressFile.' 2>&1 & echo $!';
400408
// Make sure there isn't a lockfile for this audio file already
401409
$lockFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$destAudioFile.'.lock';
@@ -418,8 +426,8 @@ public function getAudioUrl($filePath, $audioOptions): string
418426
} else {
419427
// Kick off the transcoding
420428
$this->executeShellCommand($ffmpegCmd);
421-
422-
if ($audioOptions['synchronous']) {
429+
430+
if ($synchronous) {
423431
Craft::info($ffmpegCmd, __METHOD__);
424432
$url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default'];
425433
$result = Craft::getAlias($url).$destAudioFile;

0 commit comments

Comments
 (0)