-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from BuSHari/feature/add_new_arr_import_scripts
Feature/add new arr import scripts
- Loading branch information
Showing
4 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Scripts/Flow/Applications/Radarr/Radarr - Trigger Manual Import.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Scripts/Flow/Applications/Sonarr/Sonarr - Trigger Manual Import.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |