Skip to content

Commit

Permalink
Merge pull request #80 from tubededentifrice/patch-1
Browse files Browse the repository at this point in the history
Fix Radarr - Get Original Language.js -- missing URL and API key
  • Loading branch information
revenz authored Jan 14, 2025
2 parents 14c76a9 + b370101 commit 1332c54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
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;
}
}
}

0 comments on commit 1332c54

Please sign in to comment.