diff --git a/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js b/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js index b498ef3d3..1a56387f8 100644 --- a/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js +++ b/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js @@ -137,14 +137,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Select connection type let connection_type = null; try { - if (SSL == 'http') { - connection_type = http + if (SSL === 'http') { + connection_type = http; } else { - connection_type = https + connection_type = https; } } catch (e) { //console.log(`Failed to compare SSL string. Error: ${e}`); - connection_type = http + connection_type = http; } // Try to split file path to retrieve series folder name @@ -155,7 +155,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { } catch (e) { //console.log(`Failed to split file name. Error: '${e}'.\\n`); response.infoLog += `\\nFailed to split file name. Error: '${e}'.`; - return response + return response; } //console.log(`Searching for series '${term}'.`); @@ -164,7 +164,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Create variables for API call const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; let url1_body = ''; - let url2 = ``; + let url2 = ''; let SeriesID = 0; // API call to search for Series ID using the folder name @@ -181,7 +181,6 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { res.on('end', function () { resolve(); }); - }).on('error', (e) => { //console.log(`Failed to search for series. Error: '${e}'.`); response.infoLog += `\\nFailed to search for series. Error: '${e}'.`; diff --git a/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js b/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js index d738b29e2..ca4b88713 100644 --- a/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js +++ b/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js @@ -11,7 +11,9 @@ const details = () => ({ Name: 'Rename files in Sonarr', Type: 'Video', Operation: 'Transcode', - Description: `Renames the files in the current show in Sonarr according to naming format. This is done using the Sonarr API. To do this action it needs the Show ID. This code attempts to retrieve the Show ID by using the folder name of the series. To rename the correct file we need the season and episode number. To find this SXXEXX needs to be present in the file name.`, + Description: `Renames the files in the current show in Sonarr according to naming format. This is done using the Sonarr API. + To do this action it needs the Show ID. This code attempts to retrieve the Show ID by using the folder name of the series. + To rename the correct file we need the season and episode number. To find this SXXEXX needs to be present in the file name.`, Version: '1.0', Tags: '3rd party,post-processing,configurable', @@ -95,7 +97,6 @@ function sleep(ms) { // eslint-disable-next-line no-unused-vars const plugin = async (file, librarySettings, inputs, otherArguments) => { - const response = { file, removeFromDB: false, @@ -104,7 +105,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { infoLog: 'Rename Sonarr files starting.', }; - //console.log("Rename Sonarr files starting.") + //console.log('Rename Sonarr files starting.') const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign @@ -113,7 +114,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const https = require('https'); const axios = require('axios'); - //console.log("Loaded required packages.") + //console.log('Loaded required packages.') // Defines variables const SSL = inputs.Url_Protocol; @@ -122,9 +123,9 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const APIKey = inputs.Sonarr_APIKey; const sleepInterval = inputs.After_Sleep; const regex = '(S[0-9]{1,4}E[0-9]{1,2})'; - let seasonEpisodeMatch = ""; - let term = ""; - let termUri = ""; + let seasonEpisodeMatch = ''; + let term = ''; + let termUri = ''; const APIPathLookup = '/api/v3/series/lookup'; const APIPathEpisodefile = '/api/v3/episodefile'; const APIPathCommand = '/api/v3/command'; @@ -138,14 +139,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Select connection type let connection_type = null; try { - if (SSL == "http") { - connection_type = http + if (SSL === 'http') { + connection_type = http; } else { - connection_type = https + connection_type = https; } } catch (e) { //console.log(`Failed to compare SSL string. Error: ${e}`); - connection_type = http + connection_type = http; } // Try to split file path to retrieve series folder name and season-episode number @@ -180,18 +181,17 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { let url2 = ``; let url3 = ``; let SeriesID = 0; - let url1_body = ""; - let url2_body = ""; + let url1_body = ''; + let url2_body = ''; // API call to search for folder name to get Series ID try { await new Promise((resolve) => { connection_type.get(url1, (res) => { - //console.log(`Got status code '${res.statusCode}'.`) response.infoLog += `\\nGot status code '${res.statusCode}'.`; - res.on("data", function (chunk) { + res.on('data', function (chunk) { url1_body += chunk; }); @@ -233,11 +233,10 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { try { await new Promise((resolve) => { connection_type.get(url2, (res) => { - //console.log(`Got status code '${res.statusCode}'.`) response.infoLog += `\\nGot status code '${res.statusCode}'.`; - res.on("data", function (chunk) { + res.on('data', function (chunk) { url2_body += chunk; }); diff --git a/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js b/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js index 44f3db4ef..fafe59e0a 100644 --- a/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js +++ b/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js @@ -89,7 +89,6 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = async (file, librarySettings, inputs, otherArguments) => { - const response = { file, removeFromDB: false, @@ -98,7 +97,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { infoLog: 'Refresh Radarr files starting.', }; - //console.log("Refresh Radarr files starting.") + //console.log('Refresh Radarr files starting.') const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign @@ -107,7 +106,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const https = require('https'); const axios = require('axios'); - //console.log("Loaded required packages.") + //console.log('Loaded required packages.') // Create variables const SSL = inputs.Url_Protocol; @@ -115,8 +114,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const port = inputs.Radarr_Port; const APIKey = inputs.Radarr_APIKey; const sleepInterval = inputs.After_Sleep; - let term = ""; - let termUri = ""; + let term = ''; + let termUri = ''; const APIPathLookup = '/api/v3/movie/lookup'; const APIPathCommand = '/api/v3/command'; const APICommand = 'RefreshMovie'; @@ -129,14 +128,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Select connection type let connection_type = null; try { - if (SSL == "http") { - connection_type = http + if (SSL == 'http') { + connection_type = http; } else { - connection_type = https + connection_type = https; } } catch (e) { //console.log(`Failed to compare SSL string. Error: ${e}`); - connection_type = http + connection_type = http; } // Try to split file path to retrieve movie folder name @@ -155,19 +154,18 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Create variables for API call const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; - let url1_body = ""; - let url2 = ``; + let url1_body = ''; + let url2 = ''; let MovieID = 0; // API call to search for Movie ID using the folder name try { await new Promise((resolve) => { connection_type.get(url1, (res) => { - //console.log(`Got status code '${res.statusCode}'.`) response.infoLog += `\\nGot status code '${res.statusCode}'.`; - res.on("data", function (chunk) { + res.on('data', function (chunk) { url1_body += chunk; }); diff --git a/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js b/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js index d0873ad6a..13b9f6d75 100644 --- a/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js +++ b/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js @@ -11,7 +11,8 @@ const details = () => ({ Name: 'Rename files in Radarr', Type: 'Video', Operation: 'Transcode', - Description: `Renames the files in the current movie in Radarr according to naming format. This is done using the Radarr API. To do this action it needs the Movie ID. This code attempts to retrieve the Movie ID by using the folder name of the movie.`, + Description: `Renames the files in the current movie in Radarr according to naming format. This is done using the Radarr API. + To do this action it needs the Movie ID. This code attempts to retrieve the Movie ID by using the folder name of the movie.`, Version: '1.0', Tags: '3rd party,post-processing,configurable', @@ -98,7 +99,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { infoLog: 'Rename Radarr files starting.', }; - //console.log("Rename Radarr files starting.") + //console.log('Rename Radarr files starting.') const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign @@ -107,7 +108,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const https = require('https'); const axios = require('axios'); - //console.log("Loaded required packages.") + //console.log('Loaded required packages.') // Defines variables const SSL = inputs.Url_Protocol; @@ -116,8 +117,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const APIKey = inputs.Radarr_APIKey; const sleepInterval = inputs.After_Sleep; const regex = '(S[0-9]{1,4}E[0-9]{1,2})'; - let term = ""; - let termUri = ""; + let term = ''; + let termUri = ''; const APIPathLookup = '/api/v3/movie/lookup'; const APIPathMoviefile = '/api/v3/moviefile'; const APIPathCommand = '/api/v3/command'; @@ -131,14 +132,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Select connection type let connection_type = null; try { - if (SSL == "http") { - connection_type = http + if (SSL == 'http') { + connection_type = http; } else { - connection_type = https + connection_type = https; } } catch (e) { //console.log(`Failed to compare SSL string. Error: ${e}`); - connection_type = http + connection_type = http; } // Try to split file path to retrieve movie folder name @@ -160,25 +161,23 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { let url2 = ``; let url3 = ``; let MovieID = 0; - let url1_body = ""; - let url2_body = ""; + let url1_body = ''; + let url2_body = ''; // API call to search for folder name to get Movie ID try { await new Promise((resolve) => { connection_type.get(url1, (res) => { - //console.log(`Got status code '${res.statusCode}'.`) response.infoLog += `\\nGot status code '${res.statusCode}'.`; - res.on("data", function (chunk) { + res.on('data', function (chunk) { url1_body += chunk; }); res.on('end', function () { resolve(); }); - }).on('error', (e) => { //console.log(`Failed to search for movie. Error: '${e}'.`) response.infoLog += `\\nFailed to search for movie. Error: '${e}'.`; @@ -213,11 +212,10 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { try { await new Promise((resolve) => { connection_type.get(url2, (res) => { - //console.log(`Got status code '${res.statusCode}'.`) response.infoLog += `\\nGot status code '${res.statusCode}'.`; - res.on("data", function (chunk) { + res.on('data', function (chunk) { url2_body += chunk; });