This commit is contained in:
HaveAGitGat 2020-05-15 01:13:19 +01:00
parent 925d3c2cec
commit e1ff493d7b
11 changed files with 514 additions and 749 deletions

View file

@ -1,8 +1,4 @@
module.exports.details = function details() {
return {
id: "Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable",
Stage: "Pre-processing",
@ -12,10 +8,10 @@ module.exports.details = function details() {
Description: `[Contains built-in filter] If files are not in H264, they will be transcoded into H264 using HandBrake NVENC H264. All audio and subtitles are kept. \n\n`,
Version: "1.00",
Link: "",
Tags: 'pre-processing,handbrake,nvenc h264,configurable',
Tags: "pre-processing,handbrake,nvenc h264,configurable",
Inputs: [
{
name: 'handbrake_preset',
name: "handbrake_preset",
tooltip: `\\nEnter the name of a HandBrake preset.
@ -30,10 +26,10 @@ module.exports.details = function details() {
\\nExample:\\n
Fast 1080p30
`
`,
},
{
name: 'output_container',
name: "output_container",
tooltip: `
\\nEnter the output container of the new file
@ -43,70 +39,55 @@ module.exports.details = function details() {
\\nExample:\\n
.mkv
`
`,
},
]
}
}
],
};
};
module.exports.plugin = function plugin(file, librarySettings, inputs) {
//Must return this object
var response = {
processFile: false,
preset: '',
container: '.mp4',
preset: "",
container: ".mp4",
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '',
infoLog: "",
};
if (
inputs.handbrake_preset === undefined ||
inputs.output_container === undefined
) {
response.processFile = false;
response.infoLog += "☒ Inputs not entered! \n";
return response;
}
if (inputs.handbrake_preset === undefined
|| inputs.output_container === undefined) {
response.processFile = false
response.infoLog += "☒ Inputs not entered! \n"
return response
}
if (file.ffProbeData.streams[0].codec_name == 'h264') {
response.processFile = false
response.infoLog += "☑ File is already in h264, no need to transcode! \n"
return response
if (file.ffProbeData.streams[0].codec_name == "h264") {
response.processFile = false;
response.infoLog += "☑ File is already in h264, no need to transcode! \n";
return response;
} else {
var container = inputs.output_container;
var container = inputs.output_container
if (container.charAt(0) != '.') {
container = '.' + container
if (container.charAt(0) != ".") {
container = "." + container;
}
var response = {
processFile: true,
preset: `-Z "${inputs.handbrake_preset}" -e nvenc_h264 --all-audio --all-subtitles`,
container: container,
handBrakeMode: true,
FFmpegMode: false,
reQueueAfter: true,
infoLog: '☒ File is not in h264, transcoding! \n'
}
return response
infoLog: "☒ File is not in h264, transcoding! \n",
};
return response;
}
}
};