mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
lint
This commit is contained in:
parent
a94d2823f5
commit
3c6479249d
1 changed files with 22 additions and 19 deletions
|
|
@ -1,40 +1,43 @@
|
|||
/* eslint-disable */
|
||||
module.exports = function transcodeStandardiseAudioCodecs(file, audioEncoder) {
|
||||
//Function required responses
|
||||
// Function required responses
|
||||
// preset
|
||||
// processFile
|
||||
// note
|
||||
|
||||
try {
|
||||
var audioIdx = -1;
|
||||
var hasNonSpecifiedAudioCodecStream = false;
|
||||
var ffmpegCommandInsert = "";
|
||||
var audioCodec = audioEncoder;
|
||||
let audioIdx = -1;
|
||||
let hasNonSpecifiedAudioCodecStream = false;
|
||||
let ffmpegCommandInsert = '';
|
||||
let audioCodec = audioEncoder;
|
||||
|
||||
if (audioEncoder == "dca") {
|
||||
audioCodec = "dts";
|
||||
if (audioEncoder === 'dca') {
|
||||
audioCodec = 'dts';
|
||||
}
|
||||
|
||||
if (audioEncoder == "libmp3lame") {
|
||||
audioCodec = "mp3";
|
||||
if (audioEncoder === 'libmp3lame') {
|
||||
audioCodec = 'mp3';
|
||||
}
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
|
||||
try {
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
|
||||
audioIdx++;
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio') {
|
||||
audioIdx += 1;
|
||||
}
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
// err
|
||||
}
|
||||
|
||||
try {
|
||||
if (
|
||||
file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" &&
|
||||
file.ffProbeData.streams[i].codec_name != audioCodec
|
||||
file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio'
|
||||
&& file.ffProbeData.streams[i].codec_name !== audioCodec
|
||||
) {
|
||||
ffmpegCommandInsert += ` -c:a:${audioIdx} ${audioEncoder}`;
|
||||
hasNonSpecifiedAudioCodecStream = true;
|
||||
}
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
// err
|
||||
}
|
||||
}
|
||||
|
||||
if (hasNonSpecifiedAudioCodecStream === true) {
|
||||
|
|
@ -46,13 +49,13 @@ module.exports = function transcodeStandardiseAudioCodecs(file, audioEncoder) {
|
|||
}
|
||||
|
||||
return {
|
||||
preset: "",
|
||||
preset: '',
|
||||
processFile: false,
|
||||
note: `File does not have any audio streams which aren't in ${audioCodec} \n`,
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
preset: "",
|
||||
preset: '',
|
||||
processFile: false,
|
||||
note: `library.actions.transcodeStandardiseAudioCodecs error: ${err} \n`,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue