mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 02:05:54 -07:00
Update migz audio/subtitle cleaners to slightly improve logging (#240)
* fix: minor logging improvements * chore: formatting * chore: linting/formatting
This commit is contained in:
parent
93bc0c3a93
commit
5bfe7bd474
2 changed files with 26 additions and 15 deletions
|
|
@ -139,7 +139,9 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
) {
|
||||
audioStreamsRemoved += 1;
|
||||
ffmpegCommandInsert += `-map -0:a:${audioIdx} `;
|
||||
response.infoLog += `☒Audio stream detected as being unwanted, removing. Audio stream 0:a:${audioIdx} \n`;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} has unwanted language tag ${file.ffProbeData.streams[
|
||||
i
|
||||
].tags.language.toLowerCase()}, removing. \n`;
|
||||
convert = true;
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -165,7 +167,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
) {
|
||||
audioStreamsRemoved += 1;
|
||||
ffmpegCommandInsert += `-map -0:a:${audioIdx} `;
|
||||
response.infoLog += `☒Audio stream detected as being descriptive, removing. Stream 0:a:${audioIdx} \n`;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} detected as being descriptive, removing. \n`;
|
||||
convert = true;
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -188,7 +190,8 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
.includes('und')
|
||||
) {
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} `;
|
||||
response.infoLog += `☒Audio stream detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
response.infoLog
|
||||
+= `☒Audio stream 0:a:${audioIdx} detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
convert = true;
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -200,14 +203,16 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
// No catch error here otherwise it would never detect the metadata as missing.
|
||||
if (typeof file.ffProbeData.streams[i].tags === 'undefined') {
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} `;
|
||||
response.infoLog += `☒Audio stream detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
response.infoLog
|
||||
+= `☒Audio stream 0:a:${audioIdx} detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
convert = true;
|
||||
} else if (typeof file.ffProbeData.streams[i].tags.language === 'undefined') {
|
||||
// Checks if the tags.language metadata is completely missing.
|
||||
// If so this would cause playback to show language as "undefined".
|
||||
// No catch error here otherwise it would never detect the metadata as missing.
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} `;
|
||||
response.infoLog += `☒Audio stream detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
response.infoLog
|
||||
+= `☒Audio stream 0:a:${audioIdx} detected as having no language, tagging as ${inputs.tag_language}. \n`;
|
||||
convert = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -222,17 +227,17 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
) {
|
||||
if (file.ffProbeData.streams[i].channels === 8) {
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="7.1" `;
|
||||
response.infoLog += `☒Audio stream detected as 8 channel with no title, tagging. Stream 0:a:${audioIdx} \n`;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} detected as 8 channel with no title, tagging. \n`;
|
||||
convert = true;
|
||||
}
|
||||
if (file.ffProbeData.streams[i].channels === 6) {
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="5.1" `;
|
||||
response.infoLog += `☒Audio stream detected as 6 channel with no title, tagging. Stream 0:a:${audioIdx} \n`;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} detected as 6 channel with no title, tagging. \n`;
|
||||
convert = true;
|
||||
}
|
||||
if (file.ffProbeData.streams[i].channels === 2) {
|
||||
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="2.0" `;
|
||||
response.infoLog += `☒Audio stream detected as 2 channel with no title, tagging. Stream 0:a:${audioIdx} \n`;
|
||||
response.infoLog += `☒Audio stream 0:a:${audioIdx} detected as 2 channel with no title, tagging. \n`;
|
||||
convert = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue