mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-17 19:26:27 -07:00
Tidy
This commit is contained in:
parent
925d3c2cec
commit
e1ff493d7b
11 changed files with 514 additions and 749 deletions
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue