From bf5e7de79e0935aeee7e3a59a93b7eacd9e31d28 Mon Sep 17 00:00:00 2001 From: aunefyren Date: Wed, 4 Oct 2023 14:26:25 +0200 Subject: [PATCH] Linting and new-line fixes --- ...ion_remove_stream_by_specified_property.js | 14 ++-- ...lugin_f4k2_aune_refresh_files_in_sonarr.js | 65 +++++++------- ...Plugin_f4k3_aune_rename_files_in_sonarr.js | 84 +++++++++---------- ...lugin_f4k4_aune_refresh_files_in_radarr.js | 52 ++++++------ ...Plugin_f4k5_aune_rename_files_in_radarr.js | 76 ++++++++--------- 5 files changed, 145 insertions(+), 146 deletions(-) diff --git a/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js b/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js index a66da913e..b02ca1062 100644 --- a/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js +++ b/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js @@ -112,8 +112,8 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { try { // Skip if the codec_type is filtered out if ( - codecTypeFilter.length !== 0 && - !codecTypeFilter.includes(String(file.ffProbeData.streams[i].codec_type))) { + codecTypeFilter.length !== 0 + && !codecTypeFilter.includes(String(file.ffProbeData.streams[i].codec_type))) { continue; } @@ -125,8 +125,8 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { is ${file.ffProbeData.streams[i][removeIfPropertyMissing[j]]} \n`; if ( - file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === 'undefined' || - file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === null) { + file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === 'undefined' + || file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === null) { emptyValue = true; response.infoLog += ` Removing stream ${i} which is has ${removeIfPropertyMissing[j]} missing`; break; @@ -140,8 +140,8 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { // Log the old message if the reason is not empty values if (!emptyValue) { - response.infoLog += ` Removing stream ${i} which is has ${propertyToCheck} or` + - ` of ${file.ffProbeData.streams[i][propertyToCheck]} \n`; + response.infoLog += ` Removing stream ${i} which is has ${propertyToCheck} or` + + ` of ${file.ffProbeData.streams[i][propertyToCheck]} \n`; } streamToRemove = true; @@ -165,4 +165,4 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { }; module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; 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 28b7ce9b3..b498ef3d3 100644 --- a/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js +++ b/Community/Tdarr_Plugin_f4k2_aune_refresh_files_in_sonarr.js @@ -106,7 +106,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { infoLog: 'Refresh Sonarr files starting.', }; - console.log("Refresh Sonarr files starting.") + //console.log('Refresh Sonarr files starting.'); const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign @@ -115,7 +115,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; @@ -123,8 +123,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { const port = inputs.Sonarr_Port; const APIKey = inputs.Sonarr_APIKey; const sleepInterval = inputs.After_Sleep; - let term = ""; - let termUri = ""; + let term = ''; + let termUri = ''; const APIPathLookup = '/api/v3/series/lookup'; const APIPathCommand = '/api/v3/command'; const APICommand = 'RefreshSeries'; @@ -137,13 +137,13 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Select connection type let connection_type = null; try { - if (SSL == "http") { + if (SSL == 'http') { connection_type = http } else { connection_type = https } } catch (e) { - console.log(`Failed to compare SSL string. Error: ${e}`); + //console.log(`Failed to compare SSL string. Error: ${e}`); connection_type = http } @@ -153,17 +153,17 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { term = term[term.length - 3]; termUri = encodeURI(term); } catch (e) { - console.log(`Failed to split file name. Error: '${e}'.\n`) - response.infoLog += `\nFailed to split file name. Error: '${e}'.`; + //console.log(`Failed to split file name. Error: '${e}'.\\n`); + response.infoLog += `\\nFailed to split file name. Error: '${e}'.`; return response } - console.log(`Searching for series '${term}'.`) - response.infoLog += `\nSearching for series '${term}'.`; + //console.log(`Searching for series '${term}'.`); + response.infoLog += `\\nSearching for series '${term}'.`; // Create variables for API call const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; - let url1_body = ""; + let url1_body = ''; let url2 = ``; let SeriesID = 0; @@ -171,11 +171,10 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { try { await new Promise((resolve) => { connection_type.get(url1, (res) => { + //console.log(`Got status code '${res.statusCode}'.`); + response.infoLog += `\\nGot status code '${res.statusCode}'.`; - 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; }); @@ -184,14 +183,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for series. Error: '${e}'.`) - response.infoLog += `\nFailed to search for series. Error: '${e}'.`; + //console.log(`Failed to search for series. Error: '${e}'.`); + response.infoLog += `\\nFailed to search for series. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -201,45 +200,45 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { SeriesID = APIresponse[0].id; url2 = `${SSL}://${IP}:${port}${APIPathCommand}?apikey=${APIKey}`; } catch (e) { - console.log(`Failed make JSON payload. Error: '${e}'.`); - response.infoLog += `\nFailed make JSON payload. Error: '${e}'.`; + //console.log(`Failed make JSON payload. Error: '${e}'.`); + response.infoLog += `\\nFailed make JSON payload. Error: '${e}'.`; return response; } - console.log(`Refreshing series '${SeriesID}'.`); - response.infoLog += `\nRefreshing series '${SeriesID}'.`; + //console.log(`Refreshing series '${SeriesID}'.`); + response.infoLog += `\\nRefreshing series '${SeriesID}'.`; // API request to send a command to refresh the files for the found Series ID try { await new Promise((resolve) => { axios.post(url2, { name: APICommand, - seriesId: SeriesID + seriesId: SeriesID, }) .then(function (res) { - console.log(`Got status code '${res.status}'.`) - response.infoLog += `\n☑ Got status code '${res.status}'.`; + //console.log(`Got status code '${res.status}'.`); + response.infoLog += `\\n☑ Got status code '${res.status}'.`; resolve(); }) .catch(function (error) { - console.log(`Got error: ${error}`) - response.infoLog += `\nGot error: ${error}`; + //console.log(`Got error: ${error}`); + response.infoLog += `\\nGot error: ${error}`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + // console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } // Sleep for set amount of time - console.log(`Sleeping '${sleepInterval}' ms.`); - response.infoLog += `\nSleeping '${sleepInterval}' ms.`; + // console.log(`Sleeping '${sleepInterval}' ms.`); + response.infoLog += `\\nSleeping '${sleepInterval}' ms.`; await sleep(sleepInterval); return response; }; module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; 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 0d7b992af..d738b29e2 100644 --- a/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js +++ b/Community/Tdarr_Plugin_f4k3_aune_rename_files_in_sonarr.js @@ -104,7 +104,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 +113,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; @@ -144,7 +144,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { connection_type = https } } catch (e) { - console.log(`Failed to compare SSL string. Error: ${e}`); + //console.log(`Failed to compare SSL string. Error: ${e}`); connection_type = http } @@ -157,23 +157,23 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { // Use Regex to find SXXXXEXX part of file name and save it let seasonEpisodeMatch_tmp = file.file.toString().match(regex) if (seasonEpisodeMatch_tmp == null) { - console.log(`Failed to find SXXEXX in filename.`) - response.infoLog += `\nFailed to find SXXEXX in filename.`; + //console.log(`Failed to find SXXEXX in filename.`) + response.infoLog += `\\nFailed to find SXXEXX in filename.`; return response } else { seasonEpisodeMatch = seasonEpisodeMatch_tmp[0]; } } catch (e) { - console.log(`Failed to split file name or find episode nr. Error: '${e}'.`) - response.infoLog += `\nFailed to split file name or find episode nr. Error: '${e}'.`; + //console.log(`Failed to split file name or find episode nr. Error: '${e}'.`) + response.infoLog += `\\nFailed to split file name or find episode nr. Error: '${e}'.`; return response } - console.log(`Landed on '${seasonEpisodeMatch}'.`) - response.infoLog += `\nLanded on '${seasonEpisodeMatch}'.`; + //console.log(`Landed on '${seasonEpisodeMatch}'.`) + response.infoLog += `\\nLanded on '${seasonEpisodeMatch}'.`; - console.log(`Searching for series '${term}'.`) - response.infoLog += `\nSearching for series '${term}'.`; + //console.log(`Searching for series '${term}'.`) + response.infoLog += `\\nSearching for series '${term}'.`; // Define variables to look for Series ID const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; @@ -188,8 +188,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { await new Promise((resolve) => { connection_type.get(url1, (res) => { - console.log(`Got status code '${res.statusCode}'.`) - response.infoLog += `\nGot status code '${res.statusCode}'.`; + //console.log(`Got status code '${res.statusCode}'.`) + response.infoLog += `\\nGot status code '${res.statusCode}'.`; res.on("data", function (chunk) { url1_body += chunk; @@ -200,14 +200,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for series. Error: '${e}'.`) - response.infoLog += `\nFailed to search for series. Error: '${e}'.`; + //console.log(`Failed to search for series. Error: '${e}'.`) + response.infoLog += `\\nFailed to search for series. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -218,24 +218,24 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { url2 = `${SSL}://${IP}:${port}${APIPathEpisodefile}?seriesId=${SeriesID}&includeImages=false&apikey=${APIKey}`; url3 = `${SSL}://${IP}:${port}${APIPathCommand}?apikey=${APIKey}`; } catch (e) { - console.log(`Failed make JSON payload. Error: '${e}'.`); - response.infoLog += `\nFailed make JSON payload. Error: '${e}'.`; + //console.log(`Failed make JSON payload. Error: '${e}'.`); + response.infoLog += `\\nFailed make JSON payload. Error: '${e}'.`; return response; } // Create array variable for Episode IDs let fileArray = []; - console.log(`Searching for episode files for show '${SeriesID}'.`) - response.infoLog += `\nSearching for episode files for show '${SeriesID}'.`; + //console.log(`Searching for episode files for show '${SeriesID}'.`) + response.infoLog += `\\nSearching for episode files for show '${SeriesID}'.`; // API call to find Episode IDs for Series ID try { await new Promise((resolve) => { connection_type.get(url2, (res) => { - console.log(`Got status code '${res.statusCode}'.`) - response.infoLog += `\nGot status code '${res.statusCode}'.`; + //console.log(`Got status code '${res.statusCode}'.`) + response.infoLog += `\\nGot status code '${res.statusCode}'.`; res.on("data", function (chunk) { url2_body += chunk; @@ -246,14 +246,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for files for series. Error: '${e}'.`) - response.infoLog += `\nFailed to search for files for series. Error: '${e}'.`; + //console.log(`Failed to search for files for series. Error: '${e}'.`) + response.infoLog += `\\nFailed to search for files for series. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -271,16 +271,16 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { continue; } } - console.log(`Found '${fileArray.length}' files for series.`); - response.infoLog += `\nFound '${fileArray.length}' files for series.`; + //console.log(`Found '${fileArray.length}' files for series.`); + response.infoLog += `\\nFound '${fileArray.length}' files for series.`; } catch (e) { - console.log(`Failed process episodes. Error: '${e}'.`); - response.infoLog += `\nFailed process episodes. Error: '${e}'.`; + //console.log(`Failed process episodes. Error: '${e}'.`); + response.infoLog += `\\nFailed process episodes. Error: '${e}'.`; return response; } - console.log(`Renaming files for series '${SeriesID}'.`); - response.infoLog += `\nRenaming files for series '${SeriesID}'.`; + //console.log(`Renaming files for series '${SeriesID}'.`); + response.infoLog += `\\nRenaming files for series '${SeriesID}'.`; // API call to rename the found Episode IDs for the Series ID try { @@ -291,29 +291,29 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { files: fileArray }) .then(function (res) { - console.log(`Got status code '${res.status}'.`) - response.infoLog += `\n☑ Got status code '${res.status}'.`; + //console.log(`Got status code '${res.status}'.`) + response.infoLog += `\\n☑ Got status code '${res.status}'.`; resolve(); }) .catch(function (error) { - console.log(`Got error: ${error}`) - response.infoLog += `\nGot error: ${error}`; + //console.log(`Got error: ${error}`) + response.infoLog += `\\nGot error: ${error}`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } // Sleep for set amount of time - console.log(`Sleeping '${sleepInterval}' ms.`); - response.infoLog += `\nSleeping '${sleepInterval}' ms.`; + //console.log(`Sleeping '${sleepInterval}' ms.`); + response.infoLog += `\\nSleeping '${sleepInterval}' ms.`; await sleep(sleepInterval); return response; }; module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; 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 c7051a7e4..44f3db4ef 100644 --- a/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js +++ b/Community/Tdarr_Plugin_f4k4_aune_refresh_files_in_radarr.js @@ -98,7 +98,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 +107,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; @@ -135,7 +135,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { connection_type = https } } catch (e) { - console.log(`Failed to compare SSL string. Error: ${e}`); + //console.log(`Failed to compare SSL string. Error: ${e}`); connection_type = http } @@ -145,13 +145,13 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { term = term[term.length - 2]; termUri = encodeURI(term); } catch (e) { - console.log(`Failed to split file name. Error: '${e}'.\n`) - response.infoLog += `\nFailed to split file name. Error: '${e}'.`; + //console.log(`Failed to split file name. Error: '${e}'.\\n`) + response.infoLog += `\\nFailed to split file name. Error: '${e}'.`; return response } - console.log(`Searching for movie '${term}'.`) - response.infoLog += `\nSearching for movie '${term}'.`; + //console.log(`Searching for movie '${term}'.`) + response.infoLog += `\\nSearching for movie '${term}'.`; // Create variables for API call const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; @@ -164,8 +164,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { await new Promise((resolve) => { connection_type.get(url1, (res) => { - console.log(`Got status code '${res.statusCode}'.`) - response.infoLog += `\nGot status code '${res.statusCode}'.`; + //console.log(`Got status code '${res.statusCode}'.`) + response.infoLog += `\\nGot status code '${res.statusCode}'.`; res.on("data", function (chunk) { url1_body += chunk; @@ -176,14 +176,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for movie. Error: '${e}'.`) - response.infoLog += `\nFailed to search for movie. Error: '${e}'.`; + //console.log(`Failed to search for movie. Error: '${e}'.`) + response.infoLog += `\\nFailed to search for movie. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -193,13 +193,13 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { MovieID = APIresponse[0].id; url2 = `${SSL}://${IP}:${port}${APIPathCommand}?apikey=${APIKey}`; } catch (e) { - console.log(`Failed make JSON payload. Error: '${e}'.`); - response.infoLog += `\nFailed make JSON payload. Error: '${e}'.`; + //console.log(`Failed make JSON payload. Error: '${e}'.`); + response.infoLog += `\\nFailed make JSON payload. Error: '${e}'.`; return response; } - console.log(`Refreshing movie '${MovieID}'.`); - response.infoLog += `\nRefreshing movie '${MovieID}'.`; + //console.log(`Refreshing movie '${MovieID}'.`); + response.infoLog += `\\nRefreshing movie '${MovieID}'.`; // API request to send a command to refresh the files for the found Movie ID try { @@ -209,25 +209,25 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { movieIds: [MovieID] }) .then(function (res) { - console.log(`Got status code '${res.status}'.`) - response.infoLog += `\n☑ Got status code '${res.status}'.`; + //console.log(`Got status code '${res.status}'.`) + response.infoLog += `\\n☑ Got status code '${res.status}'.`; resolve(); }) .catch(function (error) { - console.log(`Got error: ${error}`) - response.infoLog += `\nGot error: ${error}`; + //console.log(`Got error: ${error}`) + response.infoLog += `\\nGot error: ${error}`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } // Sleep for set amount of time - console.log(`Sleeping '${sleepInterval}' ms.`); - response.infoLog += `\nSleeping '${sleepInterval}' ms.`; + //console.log(`Sleeping '${sleepInterval}' ms.`); + response.infoLog += `\\nSleeping '${sleepInterval}' ms.`; await new Promise((resolve) => { setTimeout(() => { resolve(); @@ -238,4 +238,4 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }; module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; 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 80b14008e..d0873ad6a 100644 --- a/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js +++ b/Community/Tdarr_Plugin_f4k5_aune_rename_files_in_radarr.js @@ -98,7 +98,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 +107,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; @@ -137,7 +137,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { connection_type = https } } catch (e) { - console.log(`Failed to compare SSL string. Error: ${e}`); + //console.log(`Failed to compare SSL string. Error: ${e}`); connection_type = http } @@ -147,13 +147,13 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { term = term[term.length - 2]; termUri = encodeURI(term); } catch (e) { - console.log(`Failed to split file name. Error: '${e}'.`) - response.infoLog += `\nFailed to split file name. Error: '${e}'.`; + //console.log(`Failed to split file name. Error: '${e}'.`) + response.infoLog += `\\nFailed to split file name. Error: '${e}'.`; return response } - console.log(`Searching for movie '${term}'.`) - response.infoLog += `\nSearching for movie '${term}'.`; + //console.log(`Searching for movie '${term}'.`) + response.infoLog += `\\nSearching for movie '${term}'.`; // Define variables to look for Movie ID const url1 = `${SSL}://${IP}:${port}${APIPathLookup}?term=${termUri}&apikey=${APIKey}`; @@ -168,8 +168,8 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { await new Promise((resolve) => { connection_type.get(url1, (res) => { - console.log(`Got status code '${res.statusCode}'.`) - response.infoLog += `\nGot status code '${res.statusCode}'.`; + //console.log(`Got status code '${res.statusCode}'.`) + response.infoLog += `\\nGot status code '${res.statusCode}'.`; res.on("data", function (chunk) { url1_body += chunk; @@ -180,14 +180,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for movie. Error: '${e}'.`) - response.infoLog += `\nFailed to search for movie. Error: '${e}'.`; + //console.log(`Failed to search for movie. Error: '${e}'.`) + response.infoLog += `\\nFailed to search for movie. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -198,24 +198,24 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { url2 = `${SSL}://${IP}:${port}${APIPathMoviefile}?movieId=${MovieID}&includeImages=false&apikey=${APIKey}`; url3 = `${SSL}://${IP}:${port}${APIPathCommand}?apikey=${APIKey}`; } catch (e) { - console.log(`Failed make JSON payload. Error: '${e}'.`); - response.infoLog += `\nFailed make JSON payload. Error: '${e}'.`; + //console.log(`Failed make JSON payload. Error: '${e}'.`); + response.infoLog += `\\nFailed make JSON payload. Error: '${e}'.`; return response; } // Create array variable for Movie file IDs let fileArray = []; - console.log(`Searching for Movie file IDs for movie '${MovieID}'.`) - response.infoLog += `\nSearching for Movie file IDs for movie '${MovieID}'.`; + //console.log(`Searching for Movie file IDs for movie '${MovieID}'.`) + response.infoLog += `\\nSearching for Movie file IDs for movie '${MovieID}'.`; // API call to find Movie file IDs for Movie ID try { await new Promise((resolve) => { connection_type.get(url2, (res) => { - console.log(`Got status code '${res.statusCode}'.`) - response.infoLog += `\nGot status code '${res.statusCode}'.`; + //console.log(`Got status code '${res.statusCode}'.`) + response.infoLog += `\\nGot status code '${res.statusCode}'.`; res.on("data", function (chunk) { url2_body += chunk; @@ -226,14 +226,14 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }); }).on('error', (e) => { - console.log(`Failed to search for files for movie. Error: '${e}'.`) - response.infoLog += `\nFailed to search for files for movie. Error: '${e}'.`; + //console.log(`Failed to search for files for movie. Error: '${e}'.`) + response.infoLog += `\\nFailed to search for files for movie. Error: '${e}'.`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } @@ -247,16 +247,16 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { continue; } } - console.log(`Found '${fileArray.length}' files for movie.`); - response.infoLog += `\nFound '${fileArray.length}' files for movie.`; + //console.log(`Found '${fileArray.length}' files for movie.`); + response.infoLog += `\\nFound '${fileArray.length}' files for movie.`; } catch (e) { - console.log(`Failed process episodes. Error: '${e}'.`); - response.infoLog += `\nFailed process episodes. Error: '${e}'.`; + //console.log(`Failed process episodes. Error: '${e}'.`); + response.infoLog += `\\nFailed process episodes. Error: '${e}'.`; return response; } - console.log(`Renaming files for movie '${MovieID}'.`); - response.infoLog += `\nRenaming files for movie '${MovieID}'.`; + //console.log(`Renaming files for movie '${MovieID}'.`); + response.infoLog += `\\nRenaming files for movie '${MovieID}'.`; // API call to rename the found Movie file IDs for the Movie ID try { @@ -267,25 +267,25 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { files: fileArray }) .then(function (res) { - console.log(`Got status code '${res.status}'.`) - response.infoLog += `\n☑ Got status code '${res.status}'.`; + //console.log(`Got status code '${res.status}'.`) + response.infoLog += `\\n☑ Got status code '${res.status}'.`; resolve(); }) .catch(function (error) { - console.log(`Got error: ${error}`) - response.infoLog += `\nGot error: ${error}`; + //console.log(`Got error: ${error}`) + response.infoLog += `\\nGot error: ${error}`; resolve(); }); }); } catch (e) { - console.log(`Failed API call. Error: '${e}'.`); - response.infoLog += `\nFailed API call. Error: '${e}'.`; + //console.log(`Failed API call. Error: '${e}'.`); + response.infoLog += `\\nFailed API call. Error: '${e}'.`; return response; } // Sleep for set amount of time - console.log(`Sleeping '${sleepInterval}' ms.`); - response.infoLog += `\nSleeping '${sleepInterval}' ms.`; + //console.log(`Sleeping '${sleepInterval}' ms.`); + response.infoLog += `\\nSleeping '${sleepInterval}' ms.`; await new Promise((resolve) => { setTimeout(() => { resolve(); @@ -296,4 +296,4 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => { }; module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin;