Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Radarr - Get Original Language.js -- missing URL and API key #80

Merged
merged 8 commits into from
Jan 14, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ import { Radarr } from '../../../Shared/Radarr';
* @author reven
* @uid 3915f110-4b07-4e11-b7b9-50de3f5a1255
* @description Lookups a file in Radarr and gets its original language ISO-693-1 code for it
* @revision 6
* @revision 7
* @param {string} Path The full file path to lookup in Radarr
* @param {bool} ISO2 If ISO-639-2 should be returned, otherwise ISO-639-1 will be used
* @param {string} URL Radarr root URL and port (e.g., http://radarr:1234)
* @param {string} ApiKey API Key for Radarr
* @output The language was found and stored in the variable OriginalLanguage
* @output The language was not found
*/
function Script(Path, ISO2)
function Script(Path, ISO2, URI, ApiKey)
{
URI = URI || Variables["Radarr.Url"] || Variables["Radarr.URI"];
ApiKey = ApiKey || Variables["Radarr.ApiKey"];

if(!Path)
return 2;
const radarr = new Radarr();
const radarr = new Radarr(URI, ApiKey);
try
{
let language = radarr.getOriginalLanguageFromPath(Path.toString());
Expand All @@ -31,4 +36,4 @@ function Script(Path, ISO2)
Logger.WLog('Error in script: ' + err);
return 2;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import { Sonarr } from '../../../Shared/Sonarr';
/**
* @author reven
* @uid 51cf3c4f-f4a3-45e2-a083-6629397aab90
* @revision 8
* @revision 9
* @description Lookups a file in Sonarr and gets its original language ISO-693-1 code for it
* @param {string} Path The full file path to lookup in Sonarr
* @param {bool} ISO2 If ISO-639-2 should be returned, otherwise ISO-639-1 will be used
* @param {string} URL Sonarr root URL and port (e.g., http://sonarr:1234)
* @param {string} ApiKey API Key for Sonarr
* @output The language was found and stored in the variable OriginalLanguage
* @output The language was not found
*/
function Script(Path, ISO2)
function Script(Path, ISO2, URI, ApiKey)
{
URI = URI || Variables["Sonarr.Url"] || Variables["Sonarr.URI"];
ApiKey = ApiKey || Variables["Sonarr.ApiKey"];

if(!Path)
return 2;
const sonarr = new Sonarr();
const sonarr = new Sonarr(URI, ApiKey);
try
{
let language = sonarr.getOriginalLanguageFromPath(Path.toString());
Expand All @@ -32,4 +37,4 @@ function Script(Path, ISO2)
Logger.WLog('Error in script: ' + err);
return 2;
}
}
}