2021-03-05, 13:43
(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)