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