diff --git a/Tdarr_Plugin_gabehf_Make_Default_Tracks_First.js b/Tdarr_Plugin_gabehf_Make_Default_Tracks_First.js index efb005a..b0aacbc 100644 --- a/Tdarr_Plugin_gabehf_Make_Default_Tracks_First.js +++ b/Tdarr_Plugin_gabehf_Make_Default_Tracks_First.js @@ -6,7 +6,7 @@ const details = () => ({ Type: 'Video', Operation: 'Transcode', Description: - 'Re-orders streams to move default audio and subtitle tracks to be first. \\n', + 'Re-orders streams to move default audio and subtitle tracks to be first. Multiple default tracks may result in duplicate streams.\\n', Version: '1.0', Tags: 'pre-processing,ffmpeg', Inputs: [], diff --git a/Tdarr_Plugin_gabehf_Make_First_Audio_In_Lang_Default.js b/Tdarr_Plugin_gabehf_Make_First_Audio_In_Lang_Default.js index e8d1228..f881efb 100644 --- a/Tdarr_Plugin_gabehf_Make_First_Audio_In_Lang_Default.js +++ b/Tdarr_Plugin_gabehf_Make_First_Audio_In_Lang_Default.js @@ -60,10 +60,9 @@ const details = () => ({ let foundAudioInLang = false; let defaults = [] // list of tracks currently set as default - // 1, 2 jpn (default), 3 eng (default) - // [0,1,1] - // firstAudioIdx = 2 - // convert = false + // 0 jpn (default), 1 eng (default) + // [true, true] + // firstAudioInLangIdx = 0 for (let i = 0; i < file.ffProbeData.streams.length; i++) { try { @@ -71,9 +70,10 @@ const details = () => ({ defaults[audioIdx] = file.ffProbeData.streams[i].disposition.default === 1 // if we find an audio in the lang if (languages.includes(file.ffProbeData.streams[i].tags.language)) { - // mark the id and break - firstAudioInLangIdx = audioIdx; - break; + // mark the id of the first track in lang + if (firstAudioInLangIdx === -1) { + firstAudioInLangIdx = audioIdx; + } } audioIdx += 1; }