This commit is contained in:
HaveAGitGat 2020-05-15 01:26:35 +01:00
parent d28272f6d4
commit 9c8ac98728
60 changed files with 5481 additions and 5980 deletions

View file

@ -1,84 +1,94 @@
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",
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",
Inputs: [{
name: 'autoscan_address',
tooltip: `
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: `
https://subdomain.domain.tld`,
},
{
name: "autoscan_port",
tooltip: `
Enter the port Autoscan is using, default is 3468
\\nExample:\\n
3468`
},
{
name: 'autoscan_passkey',
tooltip: `
3468`,
},
{
name: "autoscan_passkey",
tooltip: `
Enter the autoscan passkey.
\\nExample:\\n
9c4b81fe234e4d6eb9011cefe514d915`
},
]
}
}
9c4b81fe234e4d6eb9011cefe514d915`,
},
],
};
};
module.exports.plugin = function plugin(file, librarySettings, inputs) {
// 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 == "") {
response.infoLog += "☒Autoscan options have not been configured, please configure all options. Skipping this plugin. \n"
response.processFile = false;
return response
// 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 == ""
) {
response.infoLog +=
"☒Autoscan options have not been configured, please configure all 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}`,
},
},
(error, res, body) => {
if (error) {
console.error(error);
}
console.log(`statusCode: ${res.statusCode}`);
console.log(body);
}
// 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}`
}
}, (error, res, body) => {
if (error) {
console.error(error)
}
console.log(`statusCode: ${res.statusCode}`)
console.log(body)
})
console.log("request next")
console.log(request.post)
}
console.log("request next");
console.log(request.post);
};