mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
Only remove audio track once
This commit is contained in:
parent
db3fecab6a
commit
e3c5b3aa1f
1 changed files with 9 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ const details = () => ({
|
|||
\\nDo NOT use this with mp4, as mp4 does not support title tags.
|
||||
\\nExample:\\n
|
||||
true
|
||||
|
||||
|
||||
\\nExample:\\n
|
||||
false`,
|
||||
},
|
||||
|
|
@ -127,6 +127,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
).length;
|
||||
|
||||
for (let i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
let removeTrack = false;
|
||||
// Catch error here incase the language metadata is completely missing.
|
||||
try {
|
||||
// Check if stream is audio
|
||||
|
|
@ -137,12 +138,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
file.ffProbeData.streams[i].tags.language.toLowerCase(),
|
||||
) === -1
|
||||
) {
|
||||
audioStreamsRemoved += 1;
|
||||
ffmpegCommandInsert += `-map -0:a:${audioIdx} `;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} has unwanted language tag ${file.ffProbeData.streams[
|
||||
i
|
||||
].tags.language.toLowerCase()}, removing. \n`;
|
||||
convert = true;
|
||||
removeTrack = true;
|
||||
}
|
||||
} catch (err) {
|
||||
// Error
|
||||
|
|
@ -165,15 +164,18 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
.includes('description')
|
||||
|| file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))
|
||||
) {
|
||||
audioStreamsRemoved += 1;
|
||||
ffmpegCommandInsert += `-map -0:a:${audioIdx} `;
|
||||
removeTrack = true;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} detected as being descriptive, removing. \n`;
|
||||
convert = true;
|
||||
}
|
||||
} catch (err) {
|
||||
// Error
|
||||
}
|
||||
|
||||
if (removeTrack){
|
||||
audioStreamsRemoved += 1;
|
||||
ffmpegCommandInsert += `-map -0:a:${audioIdx} `;
|
||||
convert = true;
|
||||
}
|
||||
// Check if inputs.tag_language has something entered
|
||||
// (Entered means user actually wants something to happen, empty would disable this)
|
||||
// AND checks that stream is audio.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue