2021-05-08, 16:44
Which part of Do not post logs in the forum. Use https://paste.kodi.tv/ instead. should we work on to make it clearer?
(2021-05-08, 16:44)DarrenHill Wrote: Which part of Do not post logs in the forum. Use https://paste.kodi.tv/ instead. should we work on to make it clearer?Thank you for being kind in your criticism :-) I've updated it with a link.
?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.netflix" name="Netflix" version="1.15.1+matrix.1" provider-name="libdev + jojo + asciidisco + caphm + castagnait">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
(2021-03-05, 13:43)CastagnaIT Wrote:(2021-03-05, 03:27)boirello Wrote: @CastagnaIT: Thanks for replying to my post regarding subtitle behaviour.I am not completely sure about this solution,
No matter what I did, I just could not make the addon enable Norwegian subtitle by default, so I had to take a look in the source code. And as I suspected, the problem seems to be the language code. A norwegian subtitle can be marked with language code "no" (Norwegian), "nb" (Norwegian Bokmål) or "nn" (Norwegian Nynorsk). The "no" code implicit means "nb", it is the same. And the "nn" code is probably not used by any international streaming providers.
Netflix is using "nb" (did not find any usage of "no" in my short, limited debugging test), but I guess the "no" code could appear. And also I think Disney+ is using "no". I could change Kodi's "Preferred subtitle language" back and forth between "Norwegian" and "Norwegian Bokmål", but that is not very user friendly.
So instead, I changed the code in kodi_ops.py, method fix_locale_languages, to call a new method:
python:
def _fix_norwegian(data_list):
kodi_subtitle_lang = get_kodi_subtitle_language()
if kodi_subtitle_lang in ["no", "nb", "nn"]:
for item in data_list:
if item.get('isNoneTrack', False):
continue
if item['language'] in ["no", "nb", "nn"]:
item['language'] = kodi_subtitle_lang
This way, the norwegian tracks is changed to the same language code as the preferred subtitle language is set to, regardless it is "Norwegian", "Norwegian Bokmål" or "Norwegian Nynorsk", and thus: The subtitle track gets enabled by default.
This is not perfect since fix_locale_languages is used for audio tracks too, and _fix_norwegian only checks Kodi's subtitle setting. But I dont know if there is a better/more elegant way to solve this, I am open for suggestions.
please open a github Issue where the situation can be tracked and discussed
and attach on the Issue post also an manifest.json after playback a video (the file is in addon user data folder)
python:
for text_track in manifest['timedtexttracks']:
if text_track['isNoneTrack']:
continue
if G.ADDON.getSettingBool('enable_forced_subtitles') == False and text_track['isForcedNarrative']:
continue # Will skip the forced subtitle from being converted, and therefore not added to subtitle playback-list..?
is_default = _is_default_subtitle(manifest, text_track)
_convert_text_track(text_track, period, is_default, cdn_index, isa_version)
(2021-05-15, 20:09)boirello Wrote:(2021-03-05, 13:43)CastagnaIT Wrote:(2021-03-05, 03:27)boirello Wrote: @CastagnaIT: Thanks for replying to my post regarding subtitle behaviour.I am not completely sure about this solution,
No matter what I did, I just could not make the addon enable Norwegian subtitle by default, so I had to take a look in the source code. And as I suspected, the problem seems to be the language code. A norwegian subtitle can be marked with language code "no" (Norwegian), "nb" (Norwegian Bokmål) or "nn" (Norwegian Nynorsk). The "no" code implicit means "nb", it is the same. And the "nn" code is probably not used by any international streaming providers.
Netflix is using "nb" (did not find any usage of "no" in my short, limited debugging test), but I guess the "no" code could appear. And also I think Disney+ is using "no". I could change Kodi's "Preferred subtitle language" back and forth between "Norwegian" and "Norwegian Bokmål", but that is not very user friendly.
So instead, I changed the code in kodi_ops.py, method fix_locale_languages, to call a new method:
python:
def _fix_norwegian(data_list):
kodi_subtitle_lang = get_kodi_subtitle_language()
if kodi_subtitle_lang in ["no", "nb", "nn"]:
for item in data_list:
if item.get('isNoneTrack', False):
continue
if item['language'] in ["no", "nb", "nn"]:
item['language'] = kodi_subtitle_lang
This way, the norwegian tracks is changed to the same language code as the preferred subtitle language is set to, regardless it is "Norwegian", "Norwegian Bokmål" or "Norwegian Nynorsk", and thus: The subtitle track gets enabled by default.
This is not perfect since fix_locale_languages is used for audio tracks too, and _fix_norwegian only checks Kodi's subtitle setting. But I dont know if there is a better/more elegant way to solve this, I am open for suggestions.
please open a github Issue where the situation can be tracked and discussed
and attach on the Issue post also an manifest.json after playback a video (the file is in addon user data folder)
I tried to create a github-account, but it got immediately flagged. Tried to contact support to unflag it, but have not heard anything. So could you create it for me?
The issue is this:
ISO-639-1 code for Norwegian is "no", but also "nb" and "nn" is used (search for "Norwegian" on https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). The code "no" and "nb" is the same. If Kodi setting for prefered language/subtitle is set to "Norwegian" ("no", tracks with "Norwegian Bokmaal" ("nb") is not selected. Disney+ and other addons uses the "no" language code, which is the normal code to use, but not Netflix: They use "nb". A simple "nb"=>"no" transformation should be sufficient.
This could be solved by the user if he/she change the Kodi setting for prefered subtitle to "Norwegian Bokmål" (nb), but this will break all the other addons.
I also have a simple feature request: Disable forced subtitles via settings
If a forced subtitle exists, it seems to be selected as default over your prefered subtitle language. Always. By removing all forced subtitles (text_track['isForcedNarrative']), Kodi will select the correct subtitle (which is in your language). And why not just make it simple by giving the user a setting to control this?
Seems like converter.py, method convert_to_dash(), is the place where we can remove forced subtitles. I have not studied the code in detail, but imagine it would be something like this:
python:
for text_track in manifest['timedtexttracks']:
if text_track['isNoneTrack']:
continue
if G.ADDON.getSettingBool('enable_forced_subtitles') == False and text_track['isForcedNarrative']:
continue # Will skip the forced subtitle from being converted, and therefore not added to subtitle playback-list..?
is_default = _is_default_subtitle(manifest, text_track)
_convert_text_track(text_track, period, is_default, cdn_index, isa_version)
(2021-05-17, 16:48)CastagnaIT Wrote: Feature request is not accepted,
Kodi already provide the option to disable the forced subtitles,
To disable forced subtitles, you have to set your chosen language name to "Preferred subititle language" in Kodi Player settings,
add another settings will make more confusion between users
(2021-05-17, 16:48)CastagnaIT Wrote: Feature request is not accepted,
Kodi already provide the option to disable the forced subtitles,
python:_convert_text_track(text_track, period, is_default, cdn_index, isa_version)
python:#_convert_text_track(text_track, period, is_default, cdn_index, isa_version)