Migz Plugins

1. Update various plugins to correctly compare against numbers.
make-only-subtitle-default
Migz93 5 years ago
parent 864cf41f1d
commit b13ae8cc29

@ -124,7 +124,7 @@ function plugin(file, librarySettings, inputs) {
// If targetBitrate comes out as 0 then something has gone wrong and bitrates could not be calculated.
// Cancel plugin completely.
if (targetBitrate === '0') {
if (targetBitrate === 0) {
response.processFile = false;
response.infoLog += 'Target bitrate could not be calculated. Skipping this plugin. \n';
return response;

@ -111,7 +111,7 @@ function plugin(file, librarySettings, inputs) {
// If targetBitrate comes out as 0 then something has gone wrong and bitrates could not be calculcated.
// Cancel plugin completely.
if (targetBitrate === '0') {
if (targetBitrate === 0) {
response.processFile = false;
response.infoLog += 'Target bitrate could not be calculated. Skipping this plugin. \n';
return response;

@ -190,17 +190,17 @@ function plugin(file, librarySettings, inputs) {
&& inputs.tag_title.toLowerCase() === 'true'
&& file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
) {
if (file.ffProbeData.streams[i].channels === '8') {
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`;
convert = true;
}
if (file.ffProbeData.streams[i].channels === '6') {
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`;
convert = true;
}
if (file.ffProbeData.streams[i].channels === '2') {
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`;
convert = true;

@ -73,13 +73,13 @@ function plugin(file, librarySettings, inputs) {
try {
// Go through all audio streams and check if 2,6 & 8 channel tracks exist or not.
if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio') {
if (file.ffProbeData.streams[i].channels === '2') {
if (file.ffProbeData.streams[i].channels === 2) {
has2Channel = true;
}
if (file.ffProbeData.streams[i].channels === '6') {
if (file.ffProbeData.streams[i].channels === 6) {
has6Channel = true;
}
if (file.ffProbeData.streams[i].channels === '8') {
if (file.ffProbeData.streams[i].channels === 8) {
has8Channel = true;
}
}
@ -100,7 +100,7 @@ function plugin(file, librarySettings, inputs) {
if (
has8Channel === true
&& has6Channel === false
&& file.ffProbeData.streams[i].channels === '8'
&& file.ffProbeData.streams[i].channels === 8
) {
ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} ac3 -ac 6 -metadata:s:a:${audioIdx} title="5.1 " `;
response.infoLog += '☒Audio track is 8 channel, no 6 channel exists. Creating 6 channel from 8 channel. \n';
@ -110,7 +110,7 @@ function plugin(file, librarySettings, inputs) {
if (
has6Channel === true
&& has2Channel === false
&& file.ffProbeData.streams[i].channels === '6'
&& file.ffProbeData.streams[i].channels === 6
) {
ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} aac -ac 2 -metadata:s:a:${audioIdx} title="2.0 " `;
response.infoLog += '☒Audio track is 6 channel, no 2 channel exists. Creating 2 channel from 6 channel. \n';
@ -128,7 +128,7 @@ function plugin(file, librarySettings, inputs) {
// Check if codec_name for stream is NOT aac AND check if channel ammount is 2.
if (
file.ffProbeData.streams[i].codec_name !== 'aac'
&& file.ffProbeData.streams[i].channels === '2'
&& file.ffProbeData.streams[i].channels === 2
) {
ffmpegCommandInsert += `-c:a:${audioIdx} aac `;
response.infoLog += '☒Audio track is 2 channel but is not AAC. Converting. \n';

@ -40,7 +40,7 @@ function plugin(file) {
// Check if audioIdx or subtitleIdx do NOT equal 0
// If so then it means a audio or subtitle track has already appeared before the video track
// So file needs to be organized.
if (audioIdx !== '0' || subtitleIdx !== '0') {
if (audioIdx !== 0 || subtitleIdx !== 0) {
convert = true;
response.infoLog += '☒ Video not first. \n';
}
@ -51,7 +51,7 @@ function plugin(file) {
// Check if subtitleIdx does NOT equal 0.
// If so then it means a subtitle track has already appeared before an audio track
// So file needs to be organized.
if (subtitleIdx !== '0') {
if (subtitleIdx !== 0) {
convert = true;
response.infoLog += '☒ Audio not second. \n';
}
@ -63,17 +63,17 @@ function plugin(file) {
// Check if audio6Idx or audio8Idx do NOT equal 0.
// If so then it means a 6 or 8 channel audio track has already appeared before the 2 channel audio track
// So file needs to be organized.
if (audio6Idx !== '0' || audio8Idx !== '0') {
if (audio6Idx !== 0 || audio8Idx !== 0) {
convert = true;
response.infoLog += '☒ Audio 2ch not first. \n';
}
}
// Check if audio track is 6 channel.
if (file.ffProbeData.streams[i].channels === '6') {
if (file.ffProbeData.streams[i].channels === 6) {
// Check if audio8Idx does NOT equal 0.
// If so then it means a 8 channel audio track has already appeared before the 6 channel audio track
// So file needs to be organized.
if (audio8Idx !== '0') {
if (audio8Idx !== 0) {
convert = true;
response.infoLog += '☒ Audio 6ch not second. \n';
}
@ -82,7 +82,7 @@ function plugin(file) {
}
// Check if audio track is 8 channel.
if (file.ffProbeData.streams[i].channels === '8') {
if (file.ffProbeData.streams[i].channels === 8) {
// Increment audio8Idx.
audio8Idx += 1;
}
@ -119,7 +119,7 @@ function plugin(file) {
// Check if stream is audio AND 2 channel.
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
&& file.ffProbeData.streams[i].channels === '2'
&& file.ffProbeData.streams[i].channels === 2
) {
ffmpegCommandInsert += `-map 0:${i} `;
}
@ -134,7 +134,7 @@ function plugin(file) {
// Check if stream is audio AND 6 channel.
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
&& file.ffProbeData.streams[i].channels === '6'
&& file.ffProbeData.streams[i].channels === 6
) {
ffmpegCommandInsert += `-map 0:${i} `;
}
@ -149,7 +149,7 @@ function plugin(file) {
// Check if stream is audio AND 8 channel.
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
&& file.ffProbeData.streams[i].channels === '8'
&& file.ffProbeData.streams[i].channels === 8
) {
ffmpegCommandInsert += `-map 0:${i} `;
}
@ -164,9 +164,9 @@ function plugin(file) {
// Check if stream is audio AND not 2, 6 or 8 channel.
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
&& file.ffProbeData.streams[i].channels !== '2'
&& file.ffProbeData.streams[i].channels !== '6'
&& file.ffProbeData.streams[i].channels !== '8'
&& file.ffProbeData.streams[i].channels !== 2
&& file.ffProbeData.streams[i].channels !== 6
&& file.ffProbeData.streams[i].channels !== 8
) {
ffmpegCommandInsert += `-map 0:${i} `;
}

Loading…
Cancel
Save