Migz Plugins

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.
This commit is contained in:
Migz93 2020-12-14 17:33:17 +00:00
parent e9370ffe7c
commit 864cf41f1d
10 changed files with 1136 additions and 882 deletions

View file

@ -1,95 +1,89 @@
/* eslint-disable */
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
module.exports.details = function details() {
return {
id: "Tdarr_Plugin_MC93_MigzPlex_Autoscan",
Stage: "Post-processing",
Name: "Send request for file to be scanned by plex_autoscan.",
Type: "Video",
Operation: "",
Description: `Send request for file to be scanned by plex_autoscan. https://github.com/l3uddz/plex_autoscan \n\n`,
Version: "1.1",
Link:
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js",
Tags: "3rd party,post-processing,configurable",
id: 'Tdarr_Plugin_MC93_MigzPlex_Autoscan',
Stage: 'Post-processing',
Name: 'Send request for file to be scanned by plex_autoscan.',
Type: 'Video',
Operation: '',
Description: 'Send request for file to be scanned by plex_autoscan. https://github.com/l3uddz/plex_autoscan \n\n',
Version: '1.2',
Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js',
Tags: '3rd party,post-processing,configurable',
Inputs: [
{
name: "autoscan_address",
tooltip: `
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
Inputs: [{
name: 'autoscan_address',
tooltip: `
Enter the IP address/URL for autoscan. Must include http(s)://
\\nExample:\\n
3468`,
},
{
name: "autoscan_passkey",
tooltip: `
Enter the autoscan passkey.
\\nExample:\\n
9c4b81fe234e4d6eb9011cefe514d915`,
},
\\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
3468`,
},
{
name: 'autoscan_passkey',
tooltip: `
Enter the autoscan passkey.
\\nExample:\\n
9c4b81fe234e4d6eb9011cefe514d915`,
},
],
};
};
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.
if (
inputs &&
inputs.autoscan_address == "" &&
inputs.autoscan_port == "" &&
inputs.autoscan_passkey == ""
inputs
&& inputs.autoscan_address === ''
&& inputs.autoscan_port === ''
&& inputs.autoscan_passkey === ''
) {
response.infoLog +=
"☒Autoscan options have not been configured, please configure all options. Skipping this plugin. \n";
response.infoLog += '☒Plugin options have not been configured, please configure options. Skipping this plugin. \n';
response.processFile = false;
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.
request.post(
{
headers: {
"content-type": "application/json",
},
url: `${ADDRESS}:${PORT}/${PASSKEY}`,
form: {
eventType: "Manual",
filepath: `${filepath}`,
},
request.post({
headers: {
'content-type': 'application/json',
},
(error, res, body) => {
if (error) {
console.error(error);
}
console.log(`statusCode: ${res.statusCode}`);
console.log(body);
url: `${ADDRESS}:${PORT}/${PASSKEY}`,
form: {
eventType: 'Manual',
filepath: `${filepath}`,
},
},
(error, res, body) => {
if (error) {
console.error(error);
}
);
console.log(`statusCode: ${res.statusCode}`);
console.log(body);
});
console.log("request next");
console.log('request next');
console.log(request.post);
};