From 70ebbc097a8070ed658bed184fef9d60a7669c8a Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 09:28:50 +0400 Subject: [PATCH 1/8] Fix Radarr - Get Original Language.js -- missing URL and API key --- .../Applications/Radarr/Radarr - Get Original Language.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js index 0ff81db..b290ac8 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js @@ -7,14 +7,16 @@ import { Radarr } from '../../../Shared/Radarr'; * @revision 6 * @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) { if(!Path) return 2; - const radarr = new Radarr(); + const radarr = new Radarr(URI, ApiKey); try { let language = radarr.getOriginalLanguageFromPath(Path.toString()); @@ -31,4 +33,4 @@ function Script(Path, ISO2) Logger.WLog('Error in script: ' + err); return 2; } -} \ No newline at end of file +} From 22c7f81b062879f9ebef68453f86d43db77e2dbe Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 09:36:33 +0400 Subject: [PATCH 2/8] Invert args order to align with other scripts --- .../Applications/Radarr/Radarr - Get Original Language.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js index b290ac8..c733c87 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js @@ -5,14 +5,14 @@ import { Radarr } from '../../../Shared/Radarr'; * @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 - * @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 + * @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 * @output The language was found and stored in the variable OriginalLanguage * @output The language was not found */ -function Script(Path, ISO2, URI, ApiKey) +function Script(URI, ApiKey, Path, ISO2) { if(!Path) return 2; From 423018ef6fec85c022fa7a28fb179757d86a0da2 Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 09:39:49 +0400 Subject: [PATCH 3/8] Allow getting the URL and API key from Variables like Radarr - Manually trigger import --- .../Flow/Applications/Radarr/Radarr - Get Original Language.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js index c733c87..877d4ad 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js @@ -14,6 +14,9 @@ import { Radarr } from '../../../Shared/Radarr'; */ function Script(URI, ApiKey, Path, ISO2) { + URI = URI || Variables["Radarr.URI"]; + ApiKey = ApiKey || Variables["Radarr.ApiKey"]; + if(!Path) return 2; const radarr = new Radarr(URI, ApiKey); From 9c8cf0ec2ca99c5ce0b9346ad9851c3e8e80d018 Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 10:47:51 +0400 Subject: [PATCH 4/8] Update Sonarr - Get Original Language.js --- .../Sonarr/Sonarr - Get Original Language.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js index a7427b8..cf1de86 100644 --- a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js @@ -6,16 +6,21 @@ import { Sonarr } from '../../../Shared/Sonarr'; * @uid 51cf3c4f-f4a3-45e2-a083-6629397aab90 * @revision 8 * @description Lookups a file in Sonarr and gets its original language ISO-693-1 code for it + * @param {string} URL Sonarr root URL and port (e.g., http://sonarr:1234) + * @param {string} ApiKey API Key for Sonarr * @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 * @output The language was found and stored in the variable OriginalLanguage * @output The language was not found */ -function Script(Path, ISO2) +function Script(URI, ApiKey, Path, ISO2) { + URI = URI || 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()); @@ -32,4 +37,4 @@ function Script(Path, ISO2) Logger.WLog('Error in script: ' + err); return 2; } -} \ No newline at end of file +} From 158980c190dd6ff9078394b4a6c6d1319575874f Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 10:53:15 +0400 Subject: [PATCH 5/8] Update Radarr - Get Original Language.js --- .../Flow/Applications/Radarr/Radarr - Get Original Language.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js index 877d4ad..26f4726 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js @@ -14,7 +14,7 @@ import { Radarr } from '../../../Shared/Radarr'; */ function Script(URI, ApiKey, Path, ISO2) { - URI = URI || Variables["Radarr.URI"]; + URI = URI || Variables["Radarr.Url"] || Variables["Radarr.URI"]; ApiKey = ApiKey || Variables["Radarr.ApiKey"]; if(!Path) From 4ad8242121327f5aa7f7e50cf1a2302e18e6875e Mon Sep 17 00:00:00 2001 From: Vincent Courcelle Date: Wed, 8 Jan 2025 10:53:34 +0400 Subject: [PATCH 6/8] Update Sonarr - Get Original Language.js --- .../Flow/Applications/Sonarr/Sonarr - Get Original Language.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js index cf1de86..d379cb7 100644 --- a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js @@ -15,7 +15,7 @@ import { Sonarr } from '../../../Shared/Sonarr'; */ function Script(URI, ApiKey, Path, ISO2) { - URI = URI || Variables["Sonarr.URI"]; + URI = URI || Variables["Sonarr.Url"] || Variables["Sonarr.URI"]; ApiKey = ApiKey || Variables["Sonarr.ApiKey"]; if(!Path) From d5d3b9ba1fb7251bb6ad95086397bcbaae251fef Mon Sep 17 00:00:00 2001 From: John Andrews Date: Wed, 15 Jan 2025 08:45:16 +1300 Subject: [PATCH 7/8] Update Radarr - Get Original Language.js updated revision, put new parameters on end to avoid breaking existing users --- .../Applications/Radarr/Radarr - Get Original Language.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js index 26f4726..45f09fa 100644 --- a/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Radarr/Radarr - Get Original Language.js @@ -4,15 +4,15 @@ 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 - * @param {string} URL Radarr root URL and port (e.g., http://radarr:1234) - * @param {string} ApiKey API Key for Radarr + * @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(URI, ApiKey, Path, ISO2) +function Script(Path, ISO2, URI, ApiKey) { URI = URI || Variables["Radarr.Url"] || Variables["Radarr.URI"]; ApiKey = ApiKey || Variables["Radarr.ApiKey"]; From b370101aac6b14bf3559153ff9d05f2a315761ec Mon Sep 17 00:00:00 2001 From: John Andrews Date: Wed, 15 Jan 2025 08:45:54 +1300 Subject: [PATCH 8/8] Update Sonarr - Get Original Language.js updated revision and moved parameters to end to avoid breaking existing users --- .../Applications/Sonarr/Sonarr - Get Original Language.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js index d379cb7..98cba91 100644 --- a/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js +++ b/Scripts/Flow/Applications/Sonarr/Sonarr - Get Original Language.js @@ -4,16 +4,16 @@ 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} URL Sonarr root URL and port (e.g., http://sonarr:1234) - * @param {string} ApiKey API Key for Sonarr * @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(URI, ApiKey, Path, ISO2) +function Script(Path, ISO2, URI, ApiKey) { URI = URI || Variables["Sonarr.Url"] || Variables["Sonarr.URI"]; ApiKey = ApiKey || Variables["Sonarr.ApiKey"];