From 813c73eb1961eea0cb9ab3d86d035b51093cec90 Mon Sep 17 00:00:00 2001 From: "jeanchristophe.mqt@gmail.com" Date: Fri, 10 Jan 2025 22:42:51 +0100 Subject: [PATCH] Corrected logs --- .../ffmpegCommandSetDefaultAudioStream/1.0.0/index.js | 10 ++++++---- .../ffmpegCommandSetDefaultAudioStream/1.0.0/index.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.js index a6e5dd566..9d63286e3 100644 --- a/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.js @@ -139,13 +139,15 @@ var plugin = function (args) { var _a, _b, _c, _d, _e, _f, _g, _h; if (stream.codec_type === 'audio') { var dispositions = stream.disposition; + var streamChannels = (_a = stream.channels) !== null && _a !== void 0 ? _a : 0; + var streamLanguage = (_c = (_b = stream.tags) === null || _b === void 0 ? void 0 : _b.language) !== null && _c !== void 0 ? _c : ''; var isDescriptiveAudioStream = getIsDescriptiveAudioStream(stream); - if (((_b = (_a = stream.tags) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : '') === languageCode - && ((_c = stream.channels) !== null && _c !== void 0 ? _c : 0) === channels + if (streamLanguage === languageCode + && streamChannels === channels && ((_d = dispositions === null || dispositions === void 0 ? void 0 : dispositions.default) !== null && _d !== void 0 ? _d : 0) === 0 && !isDescriptiveAudioStream && !defaultSet) { - args.jobLog("Stream ".concat(index, " (language ").concat(languageCode, ", channels ").concat(channels, ") set has default")); + args.jobLog("Stream ".concat(index, " (language ").concat(streamLanguage, ", channels ").concat(streamChannels, ") set has default")); stream.outputArgs.push("-c:".concat(index), 'copy', "-disposition:".concat(index), getFFMPEGDisposition(true, dispositions)); defaultSet = true; shouldProcess = true; @@ -154,7 +156,7 @@ var plugin = function (args) { && (((_g = (_f = stream.tags) === null || _f === void 0 ? void 0 : _f.language) !== null && _g !== void 0 ? _g : '') !== languageCode || ((_h = stream.channels) !== null && _h !== void 0 ? _h : 0) !== channels || isDescriptiveAudioStream)) { - args.jobLog("Stream ".concat(index, " (language ").concat(languageCode, ", channels ").concat(channels, ", ") + args.jobLog("Stream ".concat(index, " (language ").concat(streamLanguage, ", channels ").concat(streamChannels, ", ") + "descriptive ".concat(isDescriptiveAudioStream, ") set has not default")); stream.outputArgs.push("-c:".concat(index), 'copy', "-disposition:".concat(index), getFFMPEGDisposition(false, dispositions)); shouldProcess = true; diff --git a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.ts index 7de8dffdf..f20f8238f 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/ffmpegCommand/ffmpegCommandSetDefaultAudioStream/1.0.0/index.ts @@ -167,13 +167,15 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { streams.forEach((stream, index) => { if (stream.codec_type === 'audio') { const dispositions = (stream as IStreamDisposition).disposition; + const streamChannels = stream.channels ?? 0; + const streamLanguage = stream.tags?.language ?? ''; const isDescriptiveAudioStream = getIsDescriptiveAudioStream(stream as IStreamDisposition); - if ((stream.tags?.language ?? '') === languageCode - && (stream.channels ?? 0) === channels + if (streamLanguage === languageCode + && streamChannels === channels && (dispositions?.default ?? 0) === 0 && !isDescriptiveAudioStream && !defaultSet) { - args.jobLog(`Stream ${index} (language ${languageCode}, channels ${channels}) set has default`); + args.jobLog(`Stream ${index} (language ${streamLanguage}, channels ${streamChannels}) set has default`); stream.outputArgs.push( `-c:${index}`, 'copy', @@ -186,7 +188,7 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { && ((stream.tags?.language ?? '') !== languageCode || (stream.channels ?? 0) !== channels || isDescriptiveAudioStream)) { - args.jobLog(`Stream ${index} (language ${languageCode}, channels ${channels}, ` + args.jobLog(`Stream ${index} (language ${streamLanguage}, channels ${streamChannels}, ` + `descriptive ${isDescriptiveAudioStream}) set has not default`); stream.outputArgs.push( `-c:${index}`,