From 84282a43df016d4e46f06bc45ae90891fd911894 Mon Sep 17 00:00:00 2001 From: Stephen Townsend <26904641+townsste@users.noreply.github.com> Date: Thu, 27 Jan 2022 03:43:02 -0800 Subject: [PATCH 1/3] Bug fix for Chinese orginal language Bug where a Chinese original language movie would be set as und or undefined because of the return value from TMBD as 'cn'. The iso-language expects 'zh' for Chinese. Also the array is unnecessary given TMDB should only every report a single language and is not reliant on imdb multiple languages. --- ...rr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js index 4f86e5b..f1acbfd 100644 --- a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js +++ b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js @@ -108,9 +108,15 @@ const processStreams = (result, file, user_langs) => { }; let streamIndex = 0; - const langsTemp = result.original_language; + var langsTemp = result.original_language; //Change from const to var to re-define + + if (langsTemp == 'cn') langsTemp = 'zh'; //If the original language is pulled as Chinese 'cn' is used. iso-language expects 'zh' for Chinese. + let langs = []; + /* + The TMDB should only every report a single language as original language and is not reliant on imdb languages. + if (Array.isArray(langsTemp)) { // For loop because I thought some imdb stuff returns multiple languages // Translates 'en' to 'eng', because imdb uses a different format compared to ffmpeg @@ -120,7 +126,15 @@ const processStreams = (result, file, user_langs) => { } else { langs.push(languages.alpha2ToAlpha3B(langsTemp)); } - + */ + langs.push(languages.alpha2ToAlpha3B(langsTemp)); + + //Some console reporting for clarification of what the plugin is using and reporting. + response.infoLog += 'Original language: '; + response.infoLog += `${langsTemp}`; + response.infoLog += ', Using code: '; + response.infoLog += `${languages.alpha2ToAlpha3B(langsTemp)}\n`; + if (user_langs) { langs = langs.concat(user_langs); } From b82696fabba1eb8a4f2d6a5c8df7909a497df373 Mon Sep 17 00:00:00 2001 From: Stephen Townsend <26904641+townsste@users.noreply.github.com> Date: Thu, 27 Jan 2022 17:34:38 -0800 Subject: [PATCH 2/3] Bug fix for Chinese orginal language Changes per review --- ...r_Plugin_henk_Keep_Native_Lang_Plus_Eng.js | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js index f1acbfd..ac38e7a 100644 --- a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js +++ b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js @@ -108,32 +108,15 @@ const processStreams = (result, file, user_langs) => { }; let streamIndex = 0; - var langsTemp = result.original_language; //Change from const to var to re-define - - if (langsTemp == 'cn') langsTemp = 'zh'; //If the original language is pulled as Chinese 'cn' is used. iso-language expects 'zh' for Chinese. + //If the original language is pulled as Chinese 'cn' is used. iso-language expects 'zh' for Chinese. + const langsTemp = result.original_language === 'cn' ? 'zh' : result.original_language; let langs = []; - /* - The TMDB should only every report a single language as original language and is not reliant on imdb languages. - - if (Array.isArray(langsTemp)) { - // For loop because I thought some imdb stuff returns multiple languages - // Translates 'en' to 'eng', because imdb uses a different format compared to ffmpeg - for (let i = 0; i < langsTemp.length; i += 1) { - langs.push(languages.alpha2ToAlpha3B(langsTemp)); - } - } else { - langs.push(languages.alpha2ToAlpha3B(langsTemp)); - } - */ langs.push(languages.alpha2ToAlpha3B(langsTemp)); //Some console reporting for clarification of what the plugin is using and reporting. - response.infoLog += 'Original language: '; - response.infoLog += `${langsTemp}`; - response.infoLog += ', Using code: '; - response.infoLog += `${languages.alpha2ToAlpha3B(langsTemp)}\n`; + response.infoLog += `Original language: ${langsTemp}, Using code: ${languages.alpha2ToAlpha3B(langsTemp)}\n`; if (user_langs) { langs = langs.concat(user_langs); From b5ce3f497ef7795782f312fca052fe145dc0580b Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 7 Feb 2022 05:53:40 +0000 Subject: [PATCH 3/3] Fix lint errors --- .../Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js index ac38e7a..1b91c5d 100644 --- a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js +++ b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js @@ -108,16 +108,16 @@ const processStreams = (result, file, user_langs) => { }; let streamIndex = 0; - //If the original language is pulled as Chinese 'cn' is used. iso-language expects 'zh' for Chinese. + // If the original language is pulled as Chinese 'cn' is used. iso-language expects 'zh' for Chinese. const langsTemp = result.original_language === 'cn' ? 'zh' : result.original_language; - + let langs = []; langs.push(languages.alpha2ToAlpha3B(langsTemp)); - - //Some console reporting for clarification of what the plugin is using and reporting. + + // Some console reporting for clarification of what the plugin is using and reporting. response.infoLog += `Original language: ${langsTemp}, Using code: ${languages.alpha2ToAlpha3B(langsTemp)}\n`; - + if (user_langs) { langs = langs.concat(user_langs); }