mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
Tidy
This commit is contained in:
parent
925d3c2cec
commit
e1ff493d7b
11 changed files with 514 additions and 749 deletions
|
|
@ -1,70 +1,54 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075a_FFMPEG_HEVC_Generic",
|
||||
Stage: "Pre-processing",
|
||||
Name: "FFMPEG H265",
|
||||
Type: "Video",
|
||||
Operation:"Transcode",
|
||||
Operation: "Transcode",
|
||||
Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Audio/subtitles not affected. \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js",
|
||||
Tags:'pre-processing,ffmpeg,h265,video only'
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js",
|
||||
Tags: "pre-processing,ffmpeg,h265,video only",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒File is not a video! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒File is not a video! \n";
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is a video! \n"
|
||||
response.infoLog += "☑File is a video! \n";
|
||||
}
|
||||
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_name == 'hevc') {
|
||||
response.processFile = false
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
return response
|
||||
if (file.ffProbeData.streams[0].codec_name == "hevc") {
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑File is already in hevc! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 libx265`
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 libx265`;
|
||||
response.container = ".mkv";
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`;
|
||||
return response;
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
|
||||
|
||||
module.exports.details = function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075a_Transcode_Customisable",
|
||||
Stage: "Pre-processing",
|
||||
|
|
@ -12,10 +8,10 @@ module.exports.details = function details() {
|
|||
Description: `[TESTING][Contains built-in filter] Specify codec filter and transcode arguments for HandBrake or FFmpeg \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "",
|
||||
Tags:'pre-processing,handbrake,ffmpeg,configurable',
|
||||
Tags: "pre-processing,handbrake,ffmpeg,configurable",
|
||||
Inputs: [
|
||||
{
|
||||
name: 'codecs_to_exclude',
|
||||
name: "codecs_to_exclude",
|
||||
tooltip: `Input codecs, separated by a comma, that should be excluded when processing.
|
||||
|
||||
\\nFor example, if you're transcoding into hevc (h265), then add a filter to prevent hevc being transcoded so your newly transcoded files won't be infinitely looped/processed. \\n
|
||||
|
|
@ -46,10 +42,10 @@ module.exports.details = function details() {
|
|||
|
||||
h264,vp9
|
||||
|
||||
`
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: 'cli',
|
||||
name: "cli",
|
||||
tooltip: `Enter the CLI to use.
|
||||
|
||||
\\nExample:\\n
|
||||
|
|
@ -58,10 +54,10 @@ module.exports.details = function details() {
|
|||
\\nExample:\\n
|
||||
ffmpeg
|
||||
|
||||
`
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: 'transcode_arguments',
|
||||
name: "transcode_arguments",
|
||||
tooltip: `\\nEnter HandBrake or FFmpeg transcode arguments.
|
||||
|
||||
\\nHandBrake examples:
|
||||
|
|
@ -113,10 +109,10 @@ module.exports.details = function details() {
|
|||
|
||||
|
||||
|
||||
`
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: 'output_container',
|
||||
name: "output_container",
|
||||
tooltip: `
|
||||
\\nEnter the output container of the new file
|
||||
|
||||
|
|
@ -129,80 +125,63 @@ 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.codecs_to_exclude === undefined ||
|
||||
inputs.cli === undefined ||
|
||||
inputs.transcode_arguments === undefined ||
|
||||
inputs.output_container === undefined
|
||||
) {
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ Inputs not entered! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
if (inputs.codecs_to_exclude === undefined
|
||||
|| inputs.cli === undefined
|
||||
|| inputs.transcode_arguments === undefined
|
||||
|| inputs.output_container === undefined) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ Inputs not entered! \n"
|
||||
return response
|
||||
|
||||
|
||||
if (
|
||||
inputs.codecs_to_exclude.includes(file.ffProbeData.streams[0].codec_name)
|
||||
) {
|
||||
response.processFile = false;
|
||||
response.infoLog += `☑File is already in ${file.ffProbeData.streams[0].codec_name}! \n`;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
if (inputs.codecs_to_exclude.includes(file.ffProbeData.streams[0].codec_name)) {
|
||||
response.processFile = false
|
||||
response.infoLog += `☑File is already in ${file.ffProbeData.streams[0].codec_name}! \n`
|
||||
return response
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//transcode settings
|
||||
|
||||
if (inputs.cli == `handbrake`) {
|
||||
response.handBrakeMode = true
|
||||
response.FFmpegMode = false
|
||||
response.handBrakeMode = true;
|
||||
response.FFmpegMode = false;
|
||||
} else if (inputs.cli == `ffmpeg`) {
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
} else {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ CLI not input correctly! \n"
|
||||
return response
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ CLI not input correctly! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = inputs.transcode_arguments
|
||||
response.container = inputs.output_container
|
||||
response.preset = inputs.transcode_arguments;
|
||||
response.container = inputs.output_container;
|
||||
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not in desired codec! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
response.infoLog += `☒File is not in desired codec! \n`;
|
||||
return response;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,70 +1,54 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only",
|
||||
Stage: "Pre-processing",
|
||||
Name: "FFMPEG H265 Video + Audio Kept Only",
|
||||
Type: "Video",
|
||||
Operation:"Transcode",
|
||||
Operation: "Transcode",
|
||||
Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js",
|
||||
Tags:'pre-processing,video only,ffmpeg,h265',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js",
|
||||
Tags: "pre-processing,video only,ffmpeg,h265",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒File is not a video! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒File is not a video! \n";
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is a video! \n"
|
||||
response.infoLog += "☑File is a video! \n";
|
||||
}
|
||||
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_name == 'hevc') {
|
||||
response.processFile = false
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
return response
|
||||
if (file.ffProbeData.streams[0].codec_name == "hevc") {
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑File is already in hevc! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265`
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265`;
|
||||
response.container = ".mkv";
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`;
|
||||
return response;
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,69 +1,53 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20",
|
||||
Name: "FFMPEG H265 Video + Audio Kept Only With CRF 20",
|
||||
Type: "Video",
|
||||
Operation:"Transcode",
|
||||
Operation: "Transcode",
|
||||
Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. A CRF value of 20 is used. \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js",
|
||||
Tags:'pre-processing,video only,ffmpeg,h265',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js",
|
||||
Tags: "pre-processing,video only,ffmpeg,h265",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒File is not a video! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒File is not a video! \n";
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is a video! \n"
|
||||
response.infoLog += "☑File is a video! \n";
|
||||
}
|
||||
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_name == 'hevc') {
|
||||
response.processFile = false
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
return response
|
||||
if (file.ffProbeData.streams[0].codec_name == "hevc") {
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑File is already in hevc! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265 -crf 20`
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265 -crf 20`;
|
||||
response.container = ".mkv";
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`;
|
||||
return response;
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,69 +1,53 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20",
|
||||
Name: "FFMPEG H265 Video + Audio Kept Only With CRF 20 On The GPU",
|
||||
Type: "Video",
|
||||
Operation:"Transcode",
|
||||
Operation: "Transcode",
|
||||
Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using the graphics card and a CRF value of 20. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. A CRF value of 20 is used. The GPU (graphics card) is used. \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/moodiest/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js",
|
||||
Tags:'pre-processing,video only,ffmpeg,h265',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/moodiest/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js",
|
||||
Tags: "pre-processing,video only,ffmpeg,h265",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒File is not a video! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒File is not a video! \n";
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is a video! \n"
|
||||
response.infoLog += "☑File is a video! \n";
|
||||
}
|
||||
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_name == 'hevc') {
|
||||
response.processFile = false
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
return response
|
||||
if (file.ffProbeData.streams[0].codec_name == "hevc") {
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑File is already in hevc! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 hevc_nvenc -crf 20`
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 hevc_nvenc -crf 20`;
|
||||
response.container = ".mkv";
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not hevc! \n`;
|
||||
return response;
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
|
||||
|
||||
module.exports.details = function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_076a_re_order_audio_streams",
|
||||
Stage: "Pre-processing",
|
||||
|
|
@ -12,10 +8,10 @@ module.exports.details = function details() {
|
|||
Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st audio track \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "",
|
||||
Tags:'pre-processing,audio only,ffmpeg,configurable',
|
||||
Tags: "pre-processing,audio only,ffmpeg,configurable",
|
||||
Inputs: [
|
||||
{
|
||||
name: 'preferred_language',
|
||||
name: "preferred_language",
|
||||
tooltip: `Specify one language tag for Tdarr to try and put as 1st audio track
|
||||
|
||||
\\nExample:\\n
|
||||
|
|
@ -34,122 +30,99 @@ module.exports.details = function details() {
|
|||
|
||||
de
|
||||
|
||||
`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
`,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
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: "",
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
console.log(inputs.preferred_language)
|
||||
console.log(inputs.preferred_language);
|
||||
|
||||
if (inputs.preferred_language === undefined) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ Inputs not entered! \n"
|
||||
return response
|
||||
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ Inputs not entered! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
var desiredTrackPosition = file.ffProbeData.streams.filter(
|
||||
(stream) => stream.codec_type.toLowerCase() == "video"
|
||||
).length;
|
||||
|
||||
var desiredTrackPosition = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "video").length
|
||||
|
||||
var audioInLang = file.ffProbeData.streams.filter(stream => {
|
||||
|
||||
|
||||
if (stream.codec_type.toLowerCase() == "audio"
|
||||
&& stream.tags && stream.tags.language && inputs.preferred_language.includes(stream.tags.language.toLowerCase())) {
|
||||
return true
|
||||
var audioInLang = file.ffProbeData.streams.filter((stream) => {
|
||||
if (
|
||||
stream.codec_type.toLowerCase() == "audio" &&
|
||||
stream.tags &&
|
||||
stream.tags.language &&
|
||||
inputs.preferred_language.includes(stream.tags.language.toLowerCase())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
})
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (audioInLang.length == 0) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ No audio tracks in desired language! \n"
|
||||
return response
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ No audio tracks in desired language! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
var streamToMove = audioInLang[0]
|
||||
var streamToMove = audioInLang[0];
|
||||
|
||||
if (streamToMove.index == desiredTrackPosition) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☑ Preferred language is already first audio track! \n"
|
||||
return response
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑ Preferred language is already first audio track! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
var ffmpegCommand = ', -c copy'
|
||||
var ffmpegCommand = ", -c copy";
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_type.toLowerCase() == "video") {
|
||||
ffmpegCommand += ` -map 0:v `
|
||||
ffmpegCommand += ` -map 0:v `;
|
||||
}
|
||||
|
||||
var allAudioTracks = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "audio")
|
||||
var allAudioTracks = file.ffProbeData.streams.filter(
|
||||
(stream) => stream.codec_type.toLowerCase() == "audio"
|
||||
);
|
||||
|
||||
|
||||
var streamIdx
|
||||
var streamIdx;
|
||||
|
||||
for (var i = 0; i < allAudioTracks.length; i++) {
|
||||
|
||||
if (allAudioTracks[i].index == streamToMove.index) {
|
||||
streamIdx = i
|
||||
break
|
||||
|
||||
streamIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ffmpegCommand += ` -map 0:a:${streamIdx} -disposition:a:${streamIdx} default`
|
||||
ffmpegCommand += ` -map 0:a:${streamIdx} -disposition:a:${streamIdx} default`;
|
||||
|
||||
for (var i = 0; i < allAudioTracks.length; i++) {
|
||||
|
||||
if (i !== streamIdx) {
|
||||
ffmpegCommand += ` -map 0:a:${i} -disposition:a:${i} none `
|
||||
ffmpegCommand += ` -map 0:a:${i} -disposition:a:${i} none `;
|
||||
}
|
||||
}
|
||||
|
||||
ffmpegCommand += ` -map 0:s? -map 0:d? `
|
||||
ffmpegCommand += ` -map 0:s? -map 0:d? `;
|
||||
|
||||
|
||||
|
||||
response.processFile = true
|
||||
response.preset = ffmpegCommand
|
||||
response.container = `.` + file.container
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.processFile = true;
|
||||
response.preset = ffmpegCommand;
|
||||
response.container = `.` + file.container;
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒ Desired audio lang is not first audio stream, moving! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
response.infoLog += `☒ Desired audio lang is not first audio stream, moving! \n`;
|
||||
return response;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
|
||||
|
||||
module.exports.details = function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_076b_re_order_subtitle_streams",
|
||||
Stage: "Pre-processing",
|
||||
|
|
@ -12,10 +8,10 @@ module.exports.details = function details() {
|
|||
Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st subtitle track \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "",
|
||||
Tags:'pre-processing,subtitle only,ffmpeg,configurable',
|
||||
Tags: "pre-processing,subtitle only,ffmpeg,configurable",
|
||||
Inputs: [
|
||||
{
|
||||
name: 'preferred_language',
|
||||
name: "preferred_language",
|
||||
tooltip: `Specify one language tag for Tdarr to try and put as 1st subtitle track
|
||||
|
||||
\\nExample:\\n
|
||||
|
|
@ -34,124 +30,102 @@ module.exports.details = function details() {
|
|||
|
||||
de
|
||||
|
||||
`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
`,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
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: "",
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
console.log(inputs.preferred_language)
|
||||
console.log(inputs.preferred_language);
|
||||
|
||||
if (inputs.preferred_language === undefined) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ Inputs not entered! \n"
|
||||
return response
|
||||
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ Inputs not entered! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
var desiredTrackPosition = file.ffProbeData.streams.filter(
|
||||
(stream) =>
|
||||
stream.codec_type.toLowerCase() == "video" ||
|
||||
stream.codec_type.toLowerCase() == "audio"
|
||||
).length;
|
||||
|
||||
var desiredTrackPosition = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "video" || stream.codec_type.toLowerCase() == "audio").length
|
||||
|
||||
|
||||
|
||||
var subtitleInLang = file.ffProbeData.streams.filter(stream => {
|
||||
|
||||
|
||||
if (stream.codec_type.toLowerCase() == "subtitle"
|
||||
&& stream.tags && stream.tags.language && inputs.preferred_language.includes(stream.tags.language.toLowerCase())) {
|
||||
return true
|
||||
var subtitleInLang = file.ffProbeData.streams.filter((stream) => {
|
||||
if (
|
||||
stream.codec_type.toLowerCase() == "subtitle" &&
|
||||
stream.tags &&
|
||||
stream.tags.language &&
|
||||
inputs.preferred_language.includes(stream.tags.language.toLowerCase())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
})
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (subtitleInLang.length == 0) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ No subtitle tracks in desired language! \n"
|
||||
return response
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒ No subtitle tracks in desired language! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
var streamToMove = subtitleInLang[0]
|
||||
var streamToMove = subtitleInLang[0];
|
||||
|
||||
if (streamToMove.index == desiredTrackPosition) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☑ Preferred language is already first subtitle track! \n"
|
||||
return response
|
||||
|
||||
response.processFile = false;
|
||||
response.infoLog +=
|
||||
"☑ Preferred language is already first subtitle track! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
var ffmpegCommand = ', -c copy '
|
||||
var ffmpegCommand = ", -c copy ";
|
||||
|
||||
if (file.ffProbeData.streams[0].codec_type.toLowerCase() == "video") {
|
||||
ffmpegCommand += ` -map 0:v -map 0:a `
|
||||
ffmpegCommand += ` -map 0:v -map 0:a `;
|
||||
}
|
||||
|
||||
var allSubtitleTracks = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "subtitle")
|
||||
var allSubtitleTracks = file.ffProbeData.streams.filter(
|
||||
(stream) => stream.codec_type.toLowerCase() == "subtitle"
|
||||
);
|
||||
|
||||
|
||||
var streamIdx
|
||||
var streamIdx;
|
||||
|
||||
for (var i = 0; i < allSubtitleTracks.length; i++) {
|
||||
|
||||
if (allSubtitleTracks[i].index == streamToMove.index) {
|
||||
streamIdx = i
|
||||
break
|
||||
|
||||
streamIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ffmpegCommand += ` -map 0:s:${streamIdx} -disposition:s:${streamIdx} default`
|
||||
ffmpegCommand += ` -map 0:s:${streamIdx} -disposition:s:${streamIdx} default`;
|
||||
|
||||
for (var i = 0; i < allSubtitleTracks.length; i++) {
|
||||
|
||||
if (i !== streamIdx) {
|
||||
ffmpegCommand += ` -map 0:s:${i} -disposition:a:${i} none `
|
||||
ffmpegCommand += ` -map 0:s:${i} -disposition:a:${i} none `;
|
||||
}
|
||||
}
|
||||
|
||||
ffmpegCommand += ` -map 0:d? `
|
||||
ffmpegCommand += ` -map 0:d? `;
|
||||
|
||||
|
||||
|
||||
response.processFile = true
|
||||
response.preset = ffmpegCommand
|
||||
response.container = `.` + file.container
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.processFile = true;
|
||||
response.preset = ffmpegCommand;
|
||||
response.container = `.` + file.container;
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒ Desired subtitle lang is not first subtitle stream, moving! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
response.infoLog += `☒ Desired subtitle lang is not first subtitle stream, moving! \n`;
|
||||
return response;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
|
||||
|
||||
module.exports.details = function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_43az_add_to_radarr",
|
||||
Stage: "Post-processing",
|
||||
|
|
@ -12,103 +8,96 @@ module.exports.details = function details() {
|
|||
Description: `[TESTING]Add movie to Radarr after processing \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "",
|
||||
Tags:"3rd party,post-processing,configurable",
|
||||
Tags: "3rd party,post-processing,configurable",
|
||||
|
||||
Inputs: [
|
||||
{
|
||||
name: 'server_ip',
|
||||
name: "server_ip",
|
||||
tooltip: `
|
||||
Enter the server IP address
|
||||
|
||||
\\nExample:\\n
|
||||
192.168.0.10
|
||||
`
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
name: "port",
|
||||
tooltip: `
|
||||
Enter the port Radarr is using
|
||||
|
||||
\\nExample:\\n
|
||||
7878
|
||||
`
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: 'radarr_api_key',
|
||||
name: "radarr_api_key",
|
||||
tooltip: `
|
||||
|
||||
Enter the Radarr API key. You can find it on Radarr at /settings/general
|
||||
|
||||
\\nExample:\\n
|
||||
3ff1ae1c39a2a2a397315e15266dea48
|
||||
`
|
||||
`,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||
const request = require("request");
|
||||
const IP = inputs.server_ip;
|
||||
const port = inputs.port;
|
||||
const APIKey = inputs.radarr_api_key;
|
||||
|
||||
var term = file.file.split("/");
|
||||
term = term[term.length - 1];
|
||||
term = term.split(".");
|
||||
term = term[term.length - 2];
|
||||
term = encodeURI(term);
|
||||
|
||||
console.log(IP);
|
||||
console.log(term);
|
||||
|
||||
const request = require('request')
|
||||
|
||||
const IP = inputs.server_ip
|
||||
const port = inputs.port
|
||||
const APIKey = inputs.radarr_api_key
|
||||
|
||||
|
||||
var term = file.file.split("/")
|
||||
term = term[term.length - 1]
|
||||
term = term.split(".")
|
||||
term = term[term.length - 2]
|
||||
term = encodeURI(term)
|
||||
|
||||
|
||||
console.log(IP)
|
||||
console.log(term)
|
||||
|
||||
request.get(`http://${IP}:${port}/api/movie/lookup?term=${term}&apikey=${APIKey}`, {
|
||||
json: {
|
||||
}
|
||||
}, (error, res, body) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
}
|
||||
// console.log(`statusCode: ${res.statusCode}`)
|
||||
//console.log(body)
|
||||
|
||||
|
||||
var response = body[0]
|
||||
console.log(response.title) //Shrek
|
||||
|
||||
|
||||
response.profileId = 6
|
||||
response.path = file.file
|
||||
response.qualityProfile = 6
|
||||
|
||||
|
||||
request.post(`http://${IP}:${port}/api/movie?apikey=${APIKey}`, {
|
||||
json: response
|
||||
}, (error, res, body) => {
|
||||
request.get(
|
||||
`http://${IP}:${port}/api/movie/lookup?term=${term}&apikey=${APIKey}`,
|
||||
{
|
||||
json: {},
|
||||
},
|
||||
(error, res, body) => {
|
||||
if (error) {
|
||||
console.error(error)
|
||||
console.error(error);
|
||||
}
|
||||
console.log(`statusCode: ${res.statusCode}`)
|
||||
// console.log(body)
|
||||
})
|
||||
// console.log(`statusCode: ${res.statusCode}`)
|
||||
//console.log(body)
|
||||
|
||||
})
|
||||
var response = body[0];
|
||||
console.log(response.title); //e.g. Shrek
|
||||
response.profileId = 6;
|
||||
response.path = file.file;
|
||||
response.qualityProfile = 6;
|
||||
|
||||
request.post(
|
||||
`http://${IP}:${port}/api/movie?apikey=${APIKey}`,
|
||||
{
|
||||
json: response,
|
||||
},
|
||||
(error, res, body) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
console.log(`statusCode: ${res.statusCode}`);
|
||||
// console.log(body)
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//Optional response if you need to modify database
|
||||
var response = {
|
||||
file,
|
||||
removeFromDB: false,
|
||||
updateDB: false,
|
||||
}
|
||||
};
|
||||
|
||||
//return response
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,171 +1,138 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30",
|
||||
Stage: "Pre-processing",
|
||||
Name: "HaveAGitGat HandBrake VeryFast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ",
|
||||
Name:
|
||||
"HaveAGitGat HandBrake VeryFast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ",
|
||||
Type: "Video",
|
||||
Description: `[Contains built-in filter] This plugin transcodes into H264 using HandBrake's 'Very Fast 1080p30' preset if the file is not in H264 already. It removes subs, metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (any) doesn't exist. The output container is MP4. \n\n
|
||||
`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js",
|
||||
Tags:'pre-processing,handbrake,ffmpeg,h264',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js",
|
||||
Tags: "pre-processing,handbrake,ffmpeg,h264",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile : false,
|
||||
preset : '',
|
||||
container : '.mp4',
|
||||
handBrakeMode : false,
|
||||
FFmpegMode : false,
|
||||
reQueueAfter : false,
|
||||
infoLog : '',
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
processFile: false,
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
console.log("File is not video");
|
||||
|
||||
|
||||
console.log("File is not video")
|
||||
|
||||
response.infoLog += "☒File is not video \n"
|
||||
response.infoLog += "☒File is not video \n";
|
||||
response.processFile = false;
|
||||
|
||||
return response
|
||||
return response;
|
||||
} else {
|
||||
var jsonString = JSON.stringify(file);
|
||||
|
||||
} else {
|
||||
var hasSubs = false;
|
||||
|
||||
var jsonString = JSON.stringify(file)
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
try {
|
||||
if (
|
||||
file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"
|
||||
) {
|
||||
hasSubs = true;
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
|
||||
var hasSubs = false
|
||||
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){
|
||||
|
||||
hasSubs = true
|
||||
|
||||
}
|
||||
} catch (err) { }
|
||||
}
|
||||
|
||||
|
||||
if(file.ffProbeData.streams[0].codec_name != 'h264'){
|
||||
|
||||
response.infoLog += "☒File is not in h264! \n"
|
||||
response.preset = '-Z "Very Fast 1080p30"'
|
||||
if (file.ffProbeData.streams[0].codec_name != "h264") {
|
||||
response.infoLog += "☒File is not in h264! \n";
|
||||
response.preset = '-Z "Very Fast 1080p30"';
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.handBrakeMode = true
|
||||
return response
|
||||
response.handBrakeMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is already in h264! \n";
|
||||
}
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File is already in h264! \n"
|
||||
}
|
||||
///
|
||||
|
||||
|
||||
///
|
||||
|
||||
if(hasSubs){
|
||||
|
||||
response.infoLog += "☒File has subs \n"
|
||||
response.preset = ',-sn -map 0 -c copy'
|
||||
if (hasSubs) {
|
||||
response.infoLog += "☒File has subs \n";
|
||||
response.preset = ",-sn -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has no subs \n";
|
||||
}
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File has no subs \n"
|
||||
}
|
||||
|
||||
if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has title metadata and no aac and subs \n"
|
||||
response.preset = ',-map_metadata -1 -map 0 -c copy'
|
||||
if (
|
||||
file.meta.Title != "undefined" &&
|
||||
!jsonString.includes("aac") &&
|
||||
hasSubs
|
||||
) {
|
||||
response.infoLog += "☒File has title metadata and no aac and subs \n";
|
||||
response.preset = ",-map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
if(!jsonString.includes("aac") && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has no aac track and has subs \n"
|
||||
response.preset = ',-sn -map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2'
|
||||
if (!jsonString.includes("aac") && hasSubs) {
|
||||
response.infoLog += "☒File has no aac track and has subs \n";
|
||||
response.preset =
|
||||
",-sn -map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
if(file.meta.Title != "undefined" && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has title and has subs \n"
|
||||
response.preset = ',-sn -map_metadata -1 -map 0 -c copy'
|
||||
if (file.meta.Title != "undefined" && hasSubs) {
|
||||
response.infoLog += "☒File has title and has subs \n";
|
||||
response.preset = ",-sn -map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
if(file.meta.Title != undefined ){
|
||||
|
||||
response.infoLog += "☒File has title metadata \n"
|
||||
response.preset = ',-map_metadata -1 -map 0 -c copy'
|
||||
///
|
||||
if (file.meta.Title != undefined) {
|
||||
response.infoLog += "☒File has title metadata \n";
|
||||
response.preset = ",-map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}else{
|
||||
response.infoLog += "☑File has no title metadata"
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has no title metadata";
|
||||
}
|
||||
|
||||
if(!jsonString.includes("aac")){
|
||||
|
||||
response.infoLog += "☒File has no aac track \n"
|
||||
response.preset = ',-map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2'
|
||||
if (!jsonString.includes("aac")) {
|
||||
response.infoLog += "☒File has no aac track \n";
|
||||
response.preset =
|
||||
",-map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File has aac track \n"
|
||||
}
|
||||
|
||||
|
||||
response.infoLog += "☑File meets conditions! \n"
|
||||
return response
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has aac track \n";
|
||||
}
|
||||
|
||||
response.infoLog += "☑File meets conditions! \n";
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
|
|
|||
|
|
@ -1,172 +1,138 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30",
|
||||
Stage: "Pre-processing",
|
||||
Name: "HaveAGitGat HandBrake Fast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ",
|
||||
Name:
|
||||
"HaveAGitGat HandBrake Fast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ",
|
||||
Type: "Video",
|
||||
Description: `[Contains built-in filter] This plugin transcodes into H264 using HandBrake's 'Fast 1080p30' preset if the file is not in H264 already. It removes subs, metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (any) doesn't exist. The output container is MP4. \n\n
|
||||
`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js",
|
||||
Tags:'pre-processing,handbrake,ffmpeg,h264',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js",
|
||||
Tags: "pre-processing,handbrake,ffmpeg,h264",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile : false,
|
||||
preset : '',
|
||||
container : '.mp4',
|
||||
handBrakeMode : false,
|
||||
FFmpegMode : false,
|
||||
reQueueAfter : false,
|
||||
infoLog : '',
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
processFile: false,
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
console.log("File is not video");
|
||||
|
||||
|
||||
console.log("File is not video")
|
||||
|
||||
response.infoLog += "☒File is not video \n"
|
||||
response.infoLog += "☒File is not video \n";
|
||||
response.processFile = false;
|
||||
|
||||
return response
|
||||
return response;
|
||||
} else {
|
||||
var jsonString = JSON.stringify(file);
|
||||
|
||||
} else {
|
||||
var hasSubs = false;
|
||||
|
||||
var jsonString = JSON.stringify(file)
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
try {
|
||||
if (
|
||||
file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"
|
||||
) {
|
||||
hasSubs = true;
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
|
||||
var hasSubs = false
|
||||
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){
|
||||
|
||||
hasSubs = true
|
||||
|
||||
}
|
||||
} catch (err) { }
|
||||
}
|
||||
|
||||
|
||||
if(file.ffProbeData.streams[0].codec_name != 'h264'){
|
||||
|
||||
response.infoLog += "☒File is not in h264! \n"
|
||||
response.preset = '-Z "Fast 1080p30"'
|
||||
if (file.ffProbeData.streams[0].codec_name != "h264") {
|
||||
response.infoLog += "☒File is not in h264! \n";
|
||||
response.preset = '-Z "Fast 1080p30"';
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.handBrakeMode = true
|
||||
return response
|
||||
response.handBrakeMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is already in h264! \n";
|
||||
}
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File is already in h264! \n"
|
||||
}
|
||||
///
|
||||
|
||||
|
||||
///
|
||||
|
||||
if(hasSubs){
|
||||
|
||||
response.infoLog += "☒File has subs \n"
|
||||
response.preset = ',-sn -map 0 -c copy'
|
||||
if (hasSubs) {
|
||||
response.infoLog += "☒File has subs \n";
|
||||
response.preset = ",-sn -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has no subs \n";
|
||||
}
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File has no subs \n"
|
||||
}
|
||||
|
||||
if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has title metadata and no aac and subs \n"
|
||||
response.preset = ',-map_metadata -1 -map 0 -c copy'
|
||||
if (
|
||||
file.meta.Title != "undefined" &&
|
||||
!jsonString.includes("aac") &&
|
||||
hasSubs
|
||||
) {
|
||||
response.infoLog += "☒File has title metadata and no aac and subs \n";
|
||||
response.preset = ",-map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
if(!jsonString.includes("aac") && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has no aac track and has subs \n"
|
||||
response.preset = ',-sn -map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2'
|
||||
if (!jsonString.includes("aac") && hasSubs) {
|
||||
response.infoLog += "☒File has no aac track and has subs \n";
|
||||
response.preset =
|
||||
",-sn -map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
if(file.meta.Title != "undefined" && hasSubs){
|
||||
|
||||
response.infoLog += "☒File has title and has subs \n"
|
||||
response.preset = ',-sn -map_metadata -1 -map 0 -c copy'
|
||||
if (file.meta.Title != "undefined" && hasSubs) {
|
||||
response.infoLog += "☒File has title and has subs \n";
|
||||
response.preset = ",-sn -map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
if(file.meta.Title != undefined ){
|
||||
|
||||
response.infoLog += "☒File has title metadata \n"
|
||||
response.preset = ',-map_metadata -1 -map 0 -c copy'
|
||||
///
|
||||
if (file.meta.Title != undefined) {
|
||||
response.infoLog += "☒File has title metadata \n";
|
||||
response.preset = ",-map_metadata -1 -map 0 -c copy";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}else{
|
||||
response.infoLog += "☑File has no title metadata"
|
||||
}
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has no title metadata";
|
||||
}
|
||||
|
||||
if(!jsonString.includes("aac")){
|
||||
|
||||
response.infoLog += "☒File has no aac track \n"
|
||||
response.preset = ',-map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2'
|
||||
if (!jsonString.includes("aac")) {
|
||||
response.infoLog += "☒File has no aac track \n";
|
||||
response.preset =
|
||||
",-map 0:v -map 0:a:0 -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 aac -b:a:0 192k -ac 2";
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File has aac track \n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.infoLog += "☑File meets conditions! \n"
|
||||
return response
|
||||
response.FFmpegMode = true;
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File has aac track \n";
|
||||
}
|
||||
|
||||
response.infoLog += "☑File meets conditions! \n";
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
|
||||
module.exports.plugin = plugin;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue