diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Movie Lookup.js b/Scripts/Flow/Applications/Radarr/Radarr - Movie Lookup.js index e3a9d0f..1e5ac8c 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Movie Lookup.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Movie Lookup.js @@ -3,17 +3,17 @@ import { Radarr } from 'Shared/Radarr'; /** * @name Radarr - Movie Lookup * @description This script looks up a Movie from Radarr and retrieves its metadata - * @author Idan Bush + * @author iBuSH * @uid 1153e3fb-e7bb-4162-87ad-5c15cd9c081f - * @revision 2 + * @revision 3 * @param {string} URL Radarr root URL and port (e.g., http://radarr:1234) * @param {string} ApiKey API Key for Radarr * @param {bool} UseFolderName Whether to use the folder name instead of the file name for search * @output Movie found * @output Movie not found */ -function Script(URL, ApiKey) { - URL = URL || Variables['Radarr.Url']; +function Script(URL, ApiKey, UseFolderName) { + URL = URL || Variables['Radarr.Url'] || Variables["Radarr.URI"]; ApiKey = ApiKey || Variables['Radarr.ApiKey']; const radarr = new Radarr(URL, ApiKey); const folderPath = Variables.folder.Orig.FullName; diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Trigger Manual Import.js b/Scripts/Flow/Applications/Radarr/Radarr - Trigger Manual Import.js new file mode 100644 index 0000000..cfef4a3 --- /dev/null +++ b/Scripts/Flow/Applications/Radarr/Radarr - Trigger Manual Import.js @@ -0,0 +1,37 @@ +import { Radarr } from 'Shared/Radarr'; + +/** + * @name Radarr - Trigger Manual Import 2.0 + * @uid cd8926f3-a9ab-4fa7-a36e-cceb8ad58987 + * @description Trigger Radarr to manually import the media, run after last file in folder moved. + * @author iBuSH + * @revision 1 + * @param {string} URL Radarr root URL and port (e.g. http://radarr:7878) + * @param {string} ApiKey Radarr API Key + * @param {string} ImportPath The output path for import triggering (default Working File) + * @param {bool} UseUnmappedPath Whether to Unmap the path to the original FileFlows Server path when using nodes in different platforms (e.g. Docker and Windows) + * @param {bool} MoveMode Import mode 'copy' or 'move' (default copy) + * @output Command sent + */ +function Script(URL, ApiKey, ImportPath, UseUnmappedPath, MoveMode) { + URL = URL || Variables['Radarr.Url'] || Variables["Radarr.URI"]; + ApiKey = ApiKey || Variables["Radarr.ApiKey"]; + ImportPath = ImportPath || Variables.file.FullName; + const ImportMode = MoveMode ? "move" : "copy"; + const radarr = new Radarr(URL, ApiKey); + + if (UseUnmappedPath) ImportPath = Flow.UnMapPath(ImportPath); + + Logger.ILog(`Triggering URL: ${URL}`); + Logger.ILog(`Triggering Path: ${ImportPath}`); + Logger.ILog(`Import Mode: ${ImportMode}`); + + let commandBody = { + path: ImportPath, + importMode: ImportMode + }; + + if (radarr.sendCommand('downloadedMoviesScan', commandBody)) return 1; + + return -1; +} \ No newline at end of file diff --git a/Scripts/Flow/Applications/Sonarr/Sonarr - TV Show Lookup.js b/Scripts/Flow/Applications/Sonarr/Sonarr - TV Show Lookup.js index b04c23e..3d70b10 100644 --- a/Scripts/Flow/Applications/Sonarr/Sonarr - TV Show Lookup.js +++ b/Scripts/Flow/Applications/Sonarr/Sonarr - TV Show Lookup.js @@ -3,17 +3,17 @@ import { Sonarr } from 'Shared/Sonarr'; /** * @name Sonarr - TV Show Lookup * @description This script looks up a TV Show from Sonarr and retrieves its metadata - * @author Idan Bush + * @author iBuSH * @uid 9f25c573-1c3c-4a1e-8429-5f1fc69fc6d8 - * @revision 2 + * @revision 3 * @param {string} URL Sonarr root URL and port (e.g., http://sonarr:1234) * @param {string} ApiKey API Key for Sonarr * @param {bool} UseFolderName Whether to use the folder name instead of the file name for the search pattern.
If the folder starts with "Season", "Staffel", "Saison", or "Specials", the parent folder will be used. * @output TV Show found * @output TV Show NOT found */ -function Script(URL, ApiKey) { - URL = URL || Variables['Sonarr.Url']; +function Script(URL, ApiKey, UseFolderName) { + URL = URL || Variables['Sonarr.Url'] || Variables['Sonarr.URI']; ApiKey = ApiKey || Variables['Sonarr.ApiKey']; const sonarr = new Sonarr(URL, ApiKey); const folderPath = Variables.folder.Orig.FullName; diff --git a/Scripts/Flow/Applications/Sonarr/Sonarr - Trigger Manual Import.js b/Scripts/Flow/Applications/Sonarr/Sonarr - Trigger Manual Import.js new file mode 100644 index 0000000..977ad4f --- /dev/null +++ b/Scripts/Flow/Applications/Sonarr/Sonarr - Trigger Manual Import.js @@ -0,0 +1,38 @@ +import { Sonarr } from 'Shared/Sonarr'; + +/** + * @name Sonarr - Trigger Manual Import 2.0 + * @uid 544e1d8f-c3b5-4d1a-8f2c-5fdf24126100 + * @description Trigger Sonarr to manually import the media, run after last file in folder moved. + * @author iBuSH + * @revision 1 + * @param {string} URL Sonarr root URL and port (e.g. http://sonarr:8989) + * @param {string} ApiKey Sonarr API Key + * @param {string} ImportPath The output path for import triggering (default Working File) + * @param {bool} UseUnmappedPath Whether to Unmap the path to the original FileFlows Server path when using nodes in different platforms (e.g. Docker and Windows) + * @param {bool} MoveMode Import mode 'copy' or 'move' (default copy) + * @output Command sent + */ +function Script(URL, ApiKey, ImportPath, UseUnmappedPath, MoveMode) { + URL = URL || Variables['Sonarr.Url'] || Variables['Sonarr.URI']; + ApiKey = ApiKey || Variables['Sonarr.ApiKey']; + ImportPath = ImportPath || Variables.file.FullName; + const ImportMode = MoveMode ? "move" : "copy"; + const sonarr = new Sonarr(URL, ApiKey); + + if (UseUnmappedPath) ImportPath = Flow.UnMapPath(ImportPath); + + Logger.ILog(`Triggering URL: ${URL}`); + Logger.ILog(`Triggering Path: ${ImportPath}`); + Logger.ILog(`Import Mode: ${ImportMode}`); + + + let commandBody = { + path: ImportPath, + importMode: ImportMode + }; + + if (sonarr.sendCommand('downloadedEpisodesScan', commandBody)) return 1; + + return -1; +} \ No newline at end of file