CastagnaIT / plugin.video.netflix

InputStream based Netflix plugin for Kodi
MIT License
1.92k stars 263 forks source link

The Chinese subtitles tracks are not selected automatically #1348

Closed MAN-GOR closed 2 years ago

MAN-GOR commented 2 years ago

Netflix add-on version

1.18.6

Operative systems used

Android, Windows

Kodi version used

Kodi 19 (Matrix)

Description of the bug

  1. I selected "Chinese (Traditional)" as preferred language for subtitles in the Kodi settings. When I play a video in the Netflix addon the subtitles are turned off. I have to manually select "Chinese - Hant".

  2. I selected "Chinese (Simple)" as preferred language for subtitles in the Kodi settings. When I play a video in the Netflix addon the subtitles are turned off. I have to manually select "Chinese - Hans".

Steps to reproduce the behavior

  1. Change "Interface > Regional > Language" to "Chinese (Traditional)" Select "Chinese (Traditional)" as preferred language for subtitles in the Kodi settings. Play a video in the Netflix addon which has an "Chinese - Hant" subtitle track.

  2. Change "Interface > Regional > Language" to "Chinese (Simple)" Select "Chinese (Simple)" as preferred language for subtitles in the Kodi settings. Play a video in the Netflix addon which has an "Chinese - Hans" subtitle track.

Debug log - mandatory

https://paste.kodi.tv/dasicucana.kodi

Possible fix

No response

Additional context

No response

Screenshots

螢幕擷取畫面 (3) 螢幕擷取畫面 (4)

CastagnaIT commented 2 years ago

this is a know problem since Kodi not support country codes so kodi seem to support only zh-cn/zh-tw

one solution already adopted in another similar situation is replace zh-Hant with zh-cn zh-Hans with zh-tw

but i also know that exists more macrolanguages like zh-CN, zh-HK, ... is possible that there is only hant/hans language in catalogue but i am not sure

can you check if you are able to find other type of chinese macrolanguage in catalogue? maybe try check also some old chinese movie?

please check also on audio languages

CastagnaIT commented 2 years ago

if no response in next days this will be closed and not fixed since there is no collaboration

MAN-GOR commented 2 years ago

Sorry for not replying before. There are no errors in audio language.

There are only "Chinese - Hant" and "Chinese - Hans" in the catalog.

If it is a kodi problem and cannot be solved, at least select a random "Chinese" subtitle track and display the subtitles. Now the subtitles will not be displayed and need to be turned on manually.

CastagnaIT commented 2 years ago

is not what i asked in my previous comment, i try reformulate my question:

can you check if you are able to find other types of chinese audio/subtitles languages other than Hant/Hans in video catalogue and specify the names?

If it is a kodi problem and cannot be solved,

already reply in to my previous comment, its a kodi bug that cannot be solved due to unsupported language format type the only thing we can do is apply a workaround and try to see if the situation will be better

MAN-GOR commented 2 years ago

I only found "Chinese - Hant" and "Chinese - Hans" in the Chinese subtitle language of the video catalogue, no other types just like this picture image

The Chinese audio language in the video catalogue is only "Chinese - DD+ - 2 channels", and the current add-on can automatically select the Chinese audio track

CastagnaIT commented 2 years ago

thanks, i tried do go deeper for your use case

your languages "Chinese (Traditional)" and "Chinese (Simple)" are language packages installed separately in kodi

so as first, i tried replace the language code of subtitles with the language code of packages (zh_CN, zh_TW) as mentioned before, and i have discovered that Kodi has an additional bug, so is not able to detect and select the languages installed as package, so replacing the language code from the addon does not work either...

moreover also Kodi python module xbmc.convertLanguage have the same bug, by returning an empty string instead of the language code of the language package

for the time being an appropriate solution is not possible without create a very nasty hack to falsify the language codes that suspect also will works partially, and having several language workarounds already i think will only cause more confusion

therefore a appropriate solution will take time because will need to be fixed as first in kodi core I will try to open a bug issue in Kodi when i can

MAN-GOR commented 2 years ago

Hello, I found a very good function in the addon of Disney+, I wonder if you will consider adding a similar function? It can display only the language tag you typed, e.g.

My preferred language for subtitles is "Chinese", 螢幕擷取畫面 (22) but the video will not automatically select "Chinese (Traditional)" subtitles, but "Chinese (Hong Kong)" (Because "Chinese (Hong Kong)" is above other Chinese, "Chinese (Hong Kong)" will be automatically selected) 螢幕擷取畫面 (23) However, if I enter "zh-hant" in the "Subtitle Allow List", 螢幕擷取畫面 (24) the subtitles in the video will only have "Chinese (Traditional)" KODI will be forced to choose this subtitle 螢幕擷取畫面 (25)

And can automatically select unknown audio languages, such as Cantonese Cantonese will be displayed as "unknown" in KODI, so the audio preferred language cannot automatically select "Cantonese" unless the language tag "yue" is added in "advancedsettings.xml" 螢幕擷取畫面 (26) But as long as you enter "yue" in "Default Audio", 螢幕擷取畫面 (27) the video will automatically select this unknown audio language 螢幕擷取畫面 (28)

Thanks For Reading

CastagnaIT commented 2 years ago

this is another workaround that force kodi to select a language the hours needed to implement a kind of thing on each addon is better invest in to fix the problem in kodi itself...

MAN-GOR commented 2 years ago

I know But even if KODI fixes the language code issue, my "preferred subtitle language" will select "Chinese" instead of "Chinese (Traditional)" or "Chinese (Simplified)"

Since I am from Hong Kong, I can also read "Chinese (Hong Kong)" and "Chinese (Traditional)" ("Chinese (Hong Kong)" is similar to a variant of "Chinese (Traditional)") But of course the preferred language will be "Chinese (Hong Kong)"

Although there are some videos in "Disney+" that have "Chinese (Hong Kong)" 螢幕擷取畫面 (31) However, some videos do not have "Chinese (Hong Kong)", only "Chinese (Traditional)" 螢幕擷取畫面 (32) So I will enter "zh-hk,zh-hant" in "Subtitle Allow List" (“Chinese (Hong Kong)” and “Chinese (Traditional)”) 螢幕擷取畫面 (34) When I select "Chinese" as my "Preferred subtitle language" 螢幕擷取畫面 (35) "Disney+" will automatically select "Chinese (Hong Kong)" (Because the selection position of "Chinese (Hong Kong)" is higher than "Chinese (Traditional)) 螢幕擷取畫面 (36) If the subtitle does not have "Chinese (Hong Kong)", "Chinese (Traditional)" will also be automatically selected 螢幕擷取畫面 (38)

So if KODI fixes the language code problem of "Chinese (Traditional)" and "Chinese (Simplified)", and my "Preferred Subtitle Language" also selects "Chinese (Traditional)" 螢幕擷取畫面 (39) According to my estimation, Although in "Netflix", the video can automatically select "Chinese (Traditional)" 螢幕擷取畫面 (41) But at the same time, "Disney+" videos will also automatically select "Chinese (Traditional)" instead of "Chinese (Hong Kong)" 螢幕擷取畫面 (43)

If want to solve the problem of KODI itself, probably only KODI adds "Chinese (Hong Kong)" to "Preferred Audio and Subtitle Language", and also adds "Secondary Audio and Subtitle Language"

e.g. My "Preferred Subtitle Language" select "Chinese (Hong Kong)", and "Secondary Subtitle Language" select "Chinese (Traditional)"

Sounds like KODI issue, so I should post on the KODI side?

Or if want to solve the problem in the addon, maybe only can add functions similar to "Subtitle Allow List"?

Liqianyu commented 2 years ago

@MAN-GOR matthuisman's solution does bypass Kodi to solve the problem, but it doesn't apply to other Add-ons I think to fix it once and for all, we need to go to https://github.com/xbmc/xbmc/issues https://forum.kodi.tv/ suggest Kodi improvements. I agree that the issue should be fixed in Kodi. And Kodi needs to be extended to classify Chinese.

There are different variants of Chinese for different countries and regions, e.g. Mainland China, Hong Kong, Macau, Taiwan, Malaysia, Singapore are all different. The region codes are CN, HK, MO, TW, MY, SG.

I think the subtitle language can be expanded from the current Chinese, Chinese (Simplified), Chinese (Traditional) to Chinese - Simplified - CN, Chinese - Simplified - MY&SG, Chinese - Traditional - HK&MO, Chinese - Traditional - TW, for Cantonese I know less, I think a single Chinese - Yue(or Cantonese) is enough. The audio language should be expanded from the current Chinese, Chinese (Simplified), Chinese (Traditional) to Chinese - Mandarin - CN, Chinese - Mandarin - TW, Chinese - Mandarin - MY&SG, Chinese - Cantonese "Simplified“、“Traditional”, which describes written language rather than audio.

Consider that in most cases, multiple variants will not be available at the same time. So I think according to the user-set audio and subtitle language, the priority is to match the regional variants, followed by the same glyphs. If not found in matching other glyphs that may exist (e.g. Simplified does not exist, match Traditional), the same for Mandarin.

See https://en.wikipedia.org/wiki/Sinitic_languages

CastagnaIT commented 2 years ago

@Liqianyu yeah i have already opened an Issue https://github.com/xbmc/xbmc/issues/21533 more or less i have understand what changes are needed in kodi core when i will have time for this i will try to implement a way to get language code of installed language packages in the missing parts of kodi

for glyphs of fonts is a whole other thing, for subtitles this should works already just add the appropriate fonts in kodi fonts folder, at least this works for Kodi 20, for GUI font purpose the thing is different, and require a massive change in Kodi, someone has already proposed a change but incomplete, more likely will be done in the future Kodi 21

CastagnaIT commented 2 years ago

hi @MAN-GOR sorry for the delay but i had a lot of other works to do

i have fixed kodi (PR 21776) so now should works as expected these are the test builds, choose the preferred: Windows64: http://mirrors.kodi.tv/test-builds/windows/win64/KodiSetup-20220823-df3a4336-language_fix-x64.exe Android ARM: http://mirrors.kodi.tv/test-builds/android/arm/kodi-20220823-df3a4336-language_fix-26346-armeabi-v7a.apk Android ARM64: http://mirrors.kodi.tv/test-builds/android/arm64-v8a/kodi-20220823-df3a4336-language_fix-23855-arm64-v8a.apk

I would appreciate feedback from some of you

@Liqianyu i dont think that a video service provide all that language variants, anyway with my fix now we have two new options to fix the unsupported country code in kodi: 1) install language addons packages to add support the required language 2) add in the advanced settings xml the language codes needed, since now add languagecode+countrytag works (e.g. pt-br)

now unrecognized country language code are shown without misspellings so as is, e.g. pt-br ---instead of--> Portuguese - Breton --is shown as--> Portuguese - br

MAN-GOR commented 2 years ago

thank you very much @CastagnaIT But am I missing something?

I uninstalled "KODI 19" Then install the "KODI 20 Windows 64 exe" provided by you "Chinese (Simplified)" and "Chinese (Traditional)" language packs installed 螢幕擷取畫面 2022-08-24 053633 and define the language code in "advancedsettings.xml" My "Preferred Subtitle Language" select "Chinese (Traditional)" or "MyCustomDesc(zh-tw)" 螢幕擷取畫面 2022-08-24 052351 But I tested a lot of possibilities and it didn't work either 螢幕擷取畫面 2022-08-24 053342 螢幕擷取畫面 2022-08-24 053511 螢幕擷取畫面 2022-08-24 053536 螢幕擷取畫面 2022-08-24 053809

CastagnaIT commented 2 years ago

i will try check i have tested only web streams, so not file

however from the screenshot your file looks weird seems there are too many language code duplicates with same properties

MAN-GOR commented 2 years ago

i will try check i have tested only web streams, so not file

however from the screenshot your file looks weird seems there are too many language code duplicates with same properties

Because this is what I created to test which subtitle will be selected successfully.

On the version you gave me, my "Add-ons" cannot display zip files, but in the "File manager" it can display. So I can't install "Add-ons" to test streaming.

But my first test was to upgrade from "kodi19" to "kodi20", and my kodi19 has installed streaming "add-ons". Unfortunately, it doesn't work on streaming either. At the time I thought it was because of a bug in upgrading from "kodi19" to "kodi20", so I uninstalled and reinstalled.

CastagnaIT commented 2 years ago

you have right there is a bug in kodi that not allow show the .zip files (just fixed)

on what concern the problem with video files unfurnately the problem is in ffmpeg library that kodi uses, and this cannot be fixed by our part but, i have add a possible workaround, to allow kodi recognize the right language code,

the workaround consists in to add the language code on the track "title", as following example: (zh-tw) so please try edit your video file remove the duplicates subtitles and put also in the "title" tracks the language code enclosed with brackets

This is the new build with all fixes: http://mirrors.kodi.tv/test-builds/windows/win64/KodiSetup-20220824-6bf6426b-language_fix-x64.exe

MAN-GOR commented 2 years ago

umm... Let me check again. After installing the kodi 20 you provided, I need to switch "Language" to "Chinese (Traditional)" in "System>Interface>Regional" to install the language pack. Then switch the "Preferred subtitle language" to "Chinese (Traditional)" in "System>Player>Language", Or create a new file "advancedsettings.xml" and switch "Preferred subtitle language" to "MyCustomDesc(zh-tw)". Finally, the add-ons of "Netflix" should automatically select "Chinese (Traditional)" subtitles.

But I tested it and I couldn't successfully select "Chinese (Traditional)" automatically... Should I enable debugg logging to provide log files?

CastagnaIT commented 2 years ago

you pointed out a problem i had not seen, i will check,

since you have installed the language pack can you testing by removing lang values in advancedsettings.xml?

MAN-GOR commented 2 years ago

Do you mean delete the "advancedsettings.xml" file and only switch the "Preferred subtitle language" to "Chinese (Traditional)" in "System>Player>Language"? Or something else? Sorry I don't quite understand.

If yes, I've tried switch the "Preferred subtitle language" to "Chinese (Traditional)" in "System>Player>Language", but it still doesn't automatically select.

CastagnaIT commented 2 years ago

to be sure remove advancedsettings.xml file, then when you run kodi make sure that in the "Preferred subtitle language" is set "Chinese (Traditional)"

MAN-GOR commented 2 years ago

I can confirm that the "advancedsettings.xml file" has been deleted. I even uninstalled and deleted all user data, then reinstalled. Switch "Language" to "Chinese (Traditional)" in "System>Interface>Regional" to install the language pack. Switch the "Preferred subtitle language" to "Chinese (Traditional)" in "System>Player>Language" But it still fails to automatically select "Chinese (Traditional)"

CastagnaIT commented 2 years ago

i am not able to reply your problem to me works as expected please disable all following addon settings as shown below, and try again immagine and also please give me the title of your movie, in hoping is not geo locked

MAN-GOR commented 2 years ago

No luck for me. The TV show I tested was "Chesapeake Shores" S06 螢幕擷取畫面 (55) 螢幕擷取畫面 (58) 螢幕擷取畫面 (56) 螢幕擷取畫面 (57)

CastagnaIT commented 2 years ago

ah ok now its clear this is right because in Kodi Chinese (Traditional) is the language code "zh-tw" and Chinese (Simple) is the language code "zh-cn"

but netflix stream use these subtag "Hans"/"Hant" in this use case you have to add in the advancedsettings.xml this:

<advancedsettings>
<languagecodes>
  <code>
    <short>zh-Hant</short>
    <long>Chinese (Traditional)</long>
  </code>
  <code>
    <short>zh-Hans</short>
    <long>Chinese (Simple)</long>
  </code>
</languagecodes>
</advancedsettings>
MAN-GOR commented 2 years ago

Thank you, It work now. The current "advancedsettings.xml" successfully automatically selects "Chinese (Traditional)" But I still don't know how to automatically select "Chinese (Traditional)" subtitles for local files, whether it is the previous "zh-tw" or the current "zh-Hant"

CastagnaIT commented 2 years ago

For local files you have the needed to edit the file itself, for example with MKVToolNix software

immagine

POST edit: and add in the track "title" or "name" (depends on the software) the language code enclosed with brackets as mentioned in my previous message, to allow use the kodi language code workaround

CastagnaIT commented 2 years ago

sorry sorry my browser went crazy and closed the thread and the message that i was writing, now reopened

MAN-GOR commented 2 years ago

it's ok. I got it now. I thought the parentheses weren't needed before... So parentheses are required?

CastagnaIT commented 2 years ago

yes as the screenshot example

CastagnaIT commented 2 years ago

just to inform you that in my final changes in Kodi i made easier things for local files, so will be optional add the round brackets so if you prefeer you can add the language code in the track "title"/"name" also without brackets

MAN-GOR commented 2 years ago

Thanks for all you do, could you please add "Chinese (Yue)" to "Preferred subtitle and audio language"? The language code used for "audio" is "yue", the language code used for "subtitles" is "yue" or "zh-HK".

  1. I add "Chinese (Yue)" to "advancedsettings.xml": 螢幕擷取畫面 2022-08-29 090944

  2. audio test. Use "The Boss Baby: Back in Business" in "Netflix". Before, will be displayed as "Unknown". 螢幕擷取畫面 (59) after, will be displayed as "Chinese (Yue)". 螢幕擷取畫面 (60)

  3. subtitle test. Since "Netflix" does not have "Hong Kong/Cantonese" subtitles, so use "Toy Story 4" in "Disney+". Before, will be displayed as "Unknown". 螢幕擷取畫面 (61) after, will be displayed as "Chinese (Yue)". 螢幕擷取畫面 (62) "yue" subtitles are for "Cantonese dubbed soundtrack", "Chinese (Hong Kong)" subtitles are for "English original soundtrack".

But this method only works for streaming service, Not for local files.

CastagnaIT commented 2 years ago

this addon do not works with external local subtitles files, then you have to download/open external subtitles with the kodi GUI or try find an add-on that auto-download the subtitles when playback starts

MAN-GOR commented 2 years ago

I am sorry. I mean if I don't create "advancedsettings.xml", KODI will not be able to automatically select "Cantonese audio track" on "Netflix". You can test "The Boss Baby: Back in Business" from "Netflix". Before "advancedsettings.xml" is created, "Cantonese audio track" will be displayed as "Unknown", Only after creating "advancedsettings.xml" will the name be displayed correctly and automatically selected.

CastagnaIT commented 2 years ago

yue its ISO 639-3 and can be used in IETF BCP47 as is without use it as subtag (zh-yue) but Kodi support ISO 639-1 so yue will be unknown yes the correct way is that you add it to advancedsettings

Liqianyu commented 2 years ago
zh-Hans Chinese (Simple) zh-Hant Chinese (Traditional) TW Cmn cmn Chinese yue Chinese - Yue

I added the above to my advancedsettings.xml, which allows Netflix to correctly check Enable Simplified and Traditional Chinese subtitles by default. And fixed the problem of displaying unknown language for Mandarin, Taiwanese Mandarin and Cantonese dubbing in Disney Plus. However, Disney Plus subtitles are turned off by default (unless there are mandatory subtitles) unless I set the subtitle language to Chinese, but then Netflix will not automatically turn on and select subtitles. So can this be fixed by modifying the languagecodes? Or is this a problem with the Disney Plus add-on?

CastagnaIT commented 2 years ago

language selection is managed by Kodi core not by addons, but, an addon could implement some workaround that override kodi language selection, i cannot speak of Disney addon i have no idea how it works

unless I set the subtitle language to Chinese, but then Netflix will not automatically turn on and select subtitles.

in netflix addon you can try enable setting "prefer audio/subtitle language with country code" on "playback" setting category and try to see if solve the situation

otherwise, if not works, you can try experiment this solution, set same "Chinese" language name to the two variants as follow:

<languagecodes>
    <code>
        <short>zh-Hans</short>
        <long>Chinese</long>
    </code>
    <code>
        <short>zh-Hant</short>
        <long>Chinese</long>
    </code>
    <code>
        <short>TW</short>
        <long>Cmn</long>
    </code>
    <code>
        <short>cmn</short>
        <long>Chinese</long>
    </code>
    <code>
        <short>yue</short>
        <long>Chinese - Yue</long>
    </code>
</languagecodes>
CastagnaIT commented 2 years ago

i close the issue since fixes has been merged for the next Kodi 20 Nexus release