diff --git a/resources/lib/MSLv2.py b/resources/lib/MSLv2.py index 72dabb7ad..20fcbf6ee 100644 --- a/resources/lib/MSLv2.py +++ b/resources/lib/MSLv2.py @@ -60,6 +60,10 @@ def __init__(self, nx_common): """ self.nx_common = nx_common + self.locale_id = [] + locale_id = nx_common.get_setting('locale_id') + self.locale_id.append(locale_id if locale_id else 'en-US') + self.crypto = MSLHandler(nx_common) if self.nx_common.file_exists(self.nx_common.data_path, 'msl_data.json'): @@ -82,7 +86,7 @@ def load_manifest(self, viewable_id, dolby, hevc, hdr, dolbyvision, vp9): 'url': '/manifest', 'id': 15423166626396, 'esn': esn, - 'languages': ['de-US'], + 'languages': self.locale_id, 'uiVersion': 'shakti-vb45817f4', 'clientVersion': '6.0011.474.011', 'params': { @@ -117,7 +121,7 @@ def load_manifest(self, viewable_id, dolby, hevc, hdr, dolbyvision, vp9): # subtitles addon = xbmcaddon.Addon('inputstream.adaptive') - if addon and self.nx_common.compare_versions(map(int, addon.getAddonInfo('version').split('.')), [2, 3, 8]): + if addon and self.nx_common.compare_versions(map(int, addon.getAddonInfo('version').split('.')), [2, 3, 8]) >= 0: profiles.append('webvtt-lssdh-ios8') else: profiles.append('simplesdh') @@ -189,7 +193,7 @@ def load_manifest(self, viewable_id, dolby, hevc, hdr, dolbyvision, vp9): profiles.append(dv5 + 'L50-' + prk) profiles.append(dv5 + 'L51-' + prk) - if hevc is False or vp9 is True: + if vp9 is True: profiles.append('vp9-profile0-L30-dash-cenc') profiles.append('vp9-profile0-L31-dash-cenc') profiles.append('vp9-profile0-L32-dash-cenc') @@ -253,7 +257,7 @@ def get_license(self, challenge, sid): 'url': self.last_license_url, 'id': id, 'esn': esn, - 'languages': ['de-US'], + 'languages': self.locale_id, 'uiVersion': 'shakti-v25d2fa21', 'clientVersion': '6.0011.511.011', 'params': [{ @@ -270,7 +274,7 @@ def get_license(self, challenge, sid): 'licenseType': 'STANDARD', 'clientVersion': '4.0004.899.011', 'uiVersion': 'akira', - 'languages': ['de-DE'], + 'languages': self.locale_id, 'playbackContextId': self.last_playback_context, 'drmContextIds': [self.last_drm_context], 'challenges': [{ diff --git a/resources/lib/NetflixCommon.py b/resources/lib/NetflixCommon.py index eb2d24f7a..976ec692c 100644 --- a/resources/lib/NetflixCommon.py +++ b/resources/lib/NetflixCommon.py @@ -163,8 +163,8 @@ def compare_versions(v1, v2): if len(v1) != len(v2): return len(v1) - len(v2) for i in range(0, len(v1)): - if v1[i] > v2[1]: + if v1[i] > v2[i]: return 1 - elif v1[i] < v2[1]: + elif v1[i] < v2[i]: return -1 return 0 diff --git a/resources/lib/NetflixSession.py b/resources/lib/NetflixSession.py index e2faaba69..589398cde 100644 --- a/resources/lib/NetflixSession.py +++ b/resources/lib/NetflixSession.py @@ -112,7 +112,8 @@ class NetflixSession(object): 'models/esnGeneratorModel/data/esn', 'gpsModel', 'models/userInfo/data/countryOfSignup', - 'models/userInfo/data/membershipStatus' + 'models/userInfo/data/membershipStatus', + 'models/memberContext/data/geo/preferredLocale' ] def __init__(self, cookie_path, data_path, verify_ssl, nx_common): @@ -2130,6 +2131,9 @@ def _parse_page_contents(self, content): return None self.user_data = user_data self.esn = self._parse_esn_data(user_data) + if 'preferredLocale' in user_data: + self.nx_common.set_setting('locale_id', user_data['preferredLocale']['id']) + self.api_data = { 'API_BASE_URL': user_data.get('API_BASE_URL'), 'API_ROOT': user_data.get('API_ROOT'), diff --git a/resources/settings.xml b/resources/settings.xml index 6e67365db..97e5fa7db 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -43,12 +43,13 @@ - + +