1. Made changes to all plugins following lint testing. There are still various warnings/errors but my very limited knowledge of javascript means I just don't understand what the errors mean. Or in some cases I don't understand how to split the variable across several lines to confirm to the line limits. I did manage to get it from 952 problems (943 errors, 9 warnings) down to 37 problems (28 errors, 9 warnings) 2. Fix Flawed logic in FFMPEG plugins which would cause remux conditions to never trigger. Was checking if file was HEVC & VP9 which is impossible as they're both codecs. 3. Fixed a bug with CleanTitle where plugin would fail if a stream in the file didn't have a title. 4. Modify CleanSubtitle plugin to not remove sdh subtitles. 5. Include new plugin to just perform remuxes. Mainly aimed at remuxing to mkv or mp4.make-only-subtitle-default
parent
e9370ffe7c
commit
864cf41f1d
@ -0,0 +1,130 @@
|
|||||||
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
|
function details() {
|
||||||
|
return {
|
||||||
|
id: 'Tdarr_Plugin_MC93_Migz1Remux',
|
||||||
|
Stage: 'Pre-processing',
|
||||||
|
Name: 'Migz-Remux container',
|
||||||
|
Type: 'Video',
|
||||||
|
Operation: 'Remux',
|
||||||
|
Description: 'Files will be remuxed into either mkv or mp4. \n\n',
|
||||||
|
Version: '1.1',
|
||||||
|
Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1Remux.js',
|
||||||
|
Tags: 'pre-processing,ffmpeg,video only,configurable',
|
||||||
|
Inputs: [{
|
||||||
|
name: 'container',
|
||||||
|
tooltip: `Specify output container of file
|
||||||
|
\\nEnsure that all stream types you may have are supported by your chosen container.
|
||||||
|
\\nmkv is recommended.
|
||||||
|
\\nExample:\\n
|
||||||
|
mkv
|
||||||
|
|
||||||
|
\\nExample:\\n
|
||||||
|
mp4`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'force_conform',
|
||||||
|
tooltip: `Make the file conform to output containers requirements.
|
||||||
|
\\n Drop hdmv_pgs_subtitle/eia_608/subrip/timed_id3 for MP4.
|
||||||
|
\\n Drop data streams/mov_text/eia_608/timed_id3 for MKV.
|
||||||
|
\\n Default is false.
|
||||||
|
\\nExample:\\n
|
||||||
|
true
|
||||||
|
|
||||||
|
\\nExample:\\n
|
||||||
|
false`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin(file, librarySettings, inputs) {
|
||||||
|
const response = {
|
||||||
|
processFile: false,
|
||||||
|
preset: '',
|
||||||
|
handBrakeMode: false,
|
||||||
|
FFmpegMode: true,
|
||||||
|
reQueueAfter: true,
|
||||||
|
infoLog: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if inputs.container has been configured. If it hasn't then exit plugin.
|
||||||
|
if (inputs.container === '') {
|
||||||
|
response.infoLog
|
||||||
|
+= '☒Container has not been configured, please configure required options. Skipping this plugin. \n';
|
||||||
|
response.processFile = false;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
response.container = `.${inputs.container}`;
|
||||||
|
|
||||||
|
// Check if file is a video. If it isn't then exit plugin.
|
||||||
|
if (file.fileMedium !== 'video') {
|
||||||
|
response.processFile = false;
|
||||||
|
response.infoLog += '☒File is not a video. \n';
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up required variables.
|
||||||
|
let extraArguments = '';
|
||||||
|
let convert = false;
|
||||||
|
|
||||||
|
// Check if force_conform option is checked.
|
||||||
|
// If so then check streams and add any extra parameters required to make file conform with output format.
|
||||||
|
if (inputs.force_conform === 'true') {
|
||||||
|
if (inputs.container.toLowerCase() === 'mkv') {
|
||||||
|
extraArguments += '-map -0:d ';
|
||||||
|
for (let i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||||
|
try {
|
||||||
|
if (
|
||||||
|
file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'mov_text'
|
||||||
|
|| file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'eia_608'
|
||||||
|
|| file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'timed_id3'
|
||||||
|
) {
|
||||||
|
extraArguments += `-map -0:${i} `;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inputs.container.toLowerCase() === 'mp4') {
|
||||||
|
for (let i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||||
|
try {
|
||||||
|
if (
|
||||||
|
file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'hdmv_pgs_subtitle'
|
||||||
|
|| file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'eia_608'
|
||||||
|
|| file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'subrip'
|
||||||
|
|| file.ffProbeData.streams[i].codec_name
|
||||||
|
.toLowerCase() === 'timed_id3'
|
||||||
|
) {
|
||||||
|
extraArguments += `-map -0:${i} `;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if file.container does NOT match inputs.container. If so remux file.
|
||||||
|
if (file.container !== inputs.container) {
|
||||||
|
response.infoLog += `☒File is ${file.container} but requested to be ${inputs.container} container. Remuxing. \n`;
|
||||||
|
convert = true;
|
||||||
|
} else if (file.container === inputs.container) {
|
||||||
|
response.infoLog += `☑File is already in ${inputs.container} container. \n`;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (convert === true) {
|
||||||
|
response.preset += `, -map 0 -c copy -max_muxing_queue_size 9999 ${extraArguments}`;
|
||||||
|
response.processFile = true;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports.details = details;
|
||||||
|
module.exports.plugin = plugin;
|
||||||
@ -1,95 +1,89 @@
|
|||||||
/* eslint-disable */
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||||
module.exports.details = function details() {
|
module.exports.details = function details() {
|
||||||
return {
|
return {
|
||||||
id: "Tdarr_Plugin_MC93_MigzPlex_Autoscan",
|
id: 'Tdarr_Plugin_MC93_MigzPlex_Autoscan',
|
||||||
Stage: "Post-processing",
|
Stage: 'Post-processing',
|
||||||
Name: "Send request for file to be scanned by plex_autoscan.",
|
Name: 'Send request for file to be scanned by plex_autoscan.',
|
||||||
Type: "Video",
|
Type: 'Video',
|
||||||
Operation: "",
|
Operation: '',
|
||||||
Description: `Send request for file to be scanned by plex_autoscan. https://github.com/l3uddz/plex_autoscan \n\n`,
|
Description: 'Send request for file to be scanned by plex_autoscan. https://github.com/l3uddz/plex_autoscan \n\n',
|
||||||
Version: "1.1",
|
Version: '1.2',
|
||||||
Link:
|
Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js',
|
||||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js",
|
Tags: '3rd party,post-processing,configurable',
|
||||||
Tags: "3rd party,post-processing,configurable",
|
|
||||||
|
|
||||||
Inputs: [
|
Inputs: [{
|
||||||
{
|
name: 'autoscan_address',
|
||||||
name: "autoscan_address",
|
tooltip: `
|
||||||
tooltip: `
|
Enter the IP address/URL for autoscan. Must include http(s)://
|
||||||
Enter the IP address/URL for autoscan. Must include http(s)://
|
|
||||||
|
|
||||||
\\nExample:\\n
|
|
||||||
http://192.168.0.10
|
|
||||||
|
|
||||||
\\nExample:\\n
|
|
||||||
https://subdomain.domain.tld`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "autoscan_port",
|
|
||||||
tooltip: `
|
|
||||||
Enter the port Autoscan is using, default is 3468
|
|
||||||
|
|
||||||
\\nExample:\\n
|
\\nExample:\\n
|
||||||
3468`,
|
http://192.168.0.10
|
||||||
},
|
|
||||||
{
|
\\nExample:\\n
|
||||||
name: "autoscan_passkey",
|
https://subdomain.domain.tld`,
|
||||||
tooltip: `
|
},
|
||||||
|
{
|
||||||
Enter the autoscan passkey.
|
name: 'autoscan_port',
|
||||||
|
tooltip: `
|
||||||
\\nExample:\\n
|
Enter the port Autoscan is using, default is 3468
|
||||||
9c4b81fe234e4d6eb9011cefe514d915`,
|
|
||||||
},
|
\\nExample:\\n
|
||||||
|
3468`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'autoscan_passkey',
|
||||||
|
tooltip: `
|
||||||
|
|
||||||
|
Enter the autoscan passkey.
|
||||||
|
|
||||||
|
\\nExample:\\n
|
||||||
|
9c4b81fe234e4d6eb9011cefe514d915`,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||||
|
// Set up required variables.
|
||||||
|
const request = require('request');
|
||||||
|
const ADDRESS = inputs.autoscan_address;
|
||||||
|
const PORT = inputs.autoscan_port;
|
||||||
|
const PASSKEY = inputs.autoscan_passkey;
|
||||||
|
let filepath = '';
|
||||||
|
const response = '';
|
||||||
|
filepath = `${file.file}`;
|
||||||
|
|
||||||
// Check if all inputs have been configured. If they haven't then exit plugin.
|
// Check if all inputs have been configured. If they haven't then exit plugin.
|
||||||
if (
|
if (
|
||||||
inputs &&
|
inputs
|
||||||
inputs.autoscan_address == "" &&
|
&& inputs.autoscan_address === ''
|
||||||
inputs.autoscan_port == "" &&
|
&& inputs.autoscan_port === ''
|
||||||
inputs.autoscan_passkey == ""
|
&& inputs.autoscan_passkey === ''
|
||||||
) {
|
) {
|
||||||
response.infoLog +=
|
response.infoLog += '☒Plugin options have not been configured, please configure options. Skipping this plugin. \n';
|
||||||
"☒Autoscan options have not been configured, please configure all options. Skipping this plugin. \n";
|
|
||||||
response.processFile = false;
|
response.processFile = false;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take variable inputs and turn them into read only variable
|
|
||||||
const request = require("request");
|
|
||||||
const ADDRESS = inputs.autoscan_address;
|
|
||||||
const PORT = inputs.autoscan_port;
|
|
||||||
const PASSKEY = inputs.autoscan_passkey;
|
|
||||||
|
|
||||||
// Set up required variables.
|
|
||||||
var response = "";
|
|
||||||
filepath = `${file.file}`;
|
|
||||||
|
|
||||||
// Set content of request/post.
|
// Set content of request/post.
|
||||||
request.post(
|
request.post({
|
||||||
{
|
headers: {
|
||||||
headers: {
|
'content-type': 'application/json',
|
||||||
"content-type": "application/json",
|
},
|
||||||
},
|
url: `${ADDRESS}:${PORT}/${PASSKEY}`,
|
||||||
url: `${ADDRESS}:${PORT}/${PASSKEY}`,
|
form: {
|
||||||
form: {
|
eventType: 'Manual',
|
||||||
eventType: "Manual",
|
filepath: `${filepath}`,
|
||||||
filepath: `${filepath}`,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
(error, res, body) => {
|
},
|
||||||
if (error) {
|
(error, res, body) => {
|
||||||
console.error(error);
|
if (error) {
|
||||||
}
|
console.error(error);
|
||||||
console.log(`statusCode: ${res.statusCode}`);
|
|
||||||
console.log(body);
|
|
||||||
}
|
}
|
||||||
);
|
console.log(`statusCode: ${res.statusCode}`);
|
||||||
|
console.log(body);
|
||||||
|
});
|
||||||
|
|
||||||
console.log("request next");
|
console.log('request next');
|
||||||
console.log(request.post);
|
console.log(request.post);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in new issue