Skip to content

Commit 807c9a6

Browse files
Download Widevine CDM from Googles CDN
1 parent 77b6d7a commit 807c9a6

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

lib/config.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,27 @@
1818
'i686': 'x86'
1919
}
2020

21-
WIDEVINE_DOWNLOAD_MAP = {
21+
WIDEVINE_ARCH_MAP = {
2222
'x86_64':
2323
{
24-
'Linux': 'Linux_x86_64-gcc3',
25-
'Windows': 'WINNT_x86-msvc',
26-
'Darwin': 'Darwin_x86_64-gcc3-u-i386-x86_64'},
24+
'Linux': 'x64',
25+
'Windows': 'ia32',
26+
'Darwin': 'x64'
27+
},
2728
'x86':
2829
{
29-
'Linux': 'Linux_x86-gcc3',
30-
'Windows': 'WINNT_x86-msvc',
31-
'Darwin': 'Darwin_x86_64-gcc3-u-i386-x86_64'
30+
'Linux': 'ia32',
31+
'Windows': 'ia32',
32+
'Darwin': 'ia32'
3233
}
3334
}
3435

36+
WIDEVINE_OS_MAP = {
37+
'Linux': 'linux',
38+
'Windows': 'win',
39+
'Darwin': 'mac'
40+
}
41+
3542
WIDEVINE_CDM_EXTENSIONS = (
3643
'.so',
3744
'.dll',
@@ -68,6 +75,8 @@
6875

6976
WIDEVINE_MINIMUM_KODI_VERSION = '17.4'
7077

71-
WIDEVINE_CDM_SOURCE = 'https://hg.mozilla.org/mozilla-central/raw-file/31465a03c03d1eec31cd4dd5d6b803724dcb29cd/toolkit/content/gmp-sources/widevinecdm.json'
78+
WIDEVINE_CURRENT_VERSION_URL = 'https://dl.google.com/widevine-cdm/current.txt'
79+
80+
WIDEVINE_DOWNLOAD_URL = 'https://dl.google.com/widevine-cdm/{0}-{1}-{2}.zip'
7281

7382
HLS_MINIMUM_IA_VERSION = '2.0.10'

lib/inputstreamhelper.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,22 @@ def _supports_widevine(self):
194194

195195
return True
196196

197+
def _current_widevine_cdm_version(self):
198+
return self._http_request(config.WIDEVINE_CURRENT_VERSION_URL)
199+
197200
def _install_widevine_cdm(self):
198201
dialog = xbmcgui.Dialog()
199202
if self._arch in config.WIDEVINE_DOWNLOAD_UNAVAILABLE:
200203
dialog.ok(self._language(30001), self._language(30006))
201204
return False
205+
202206
download_path = os.path.join(xbmc.translatePath('special://temp'), 'widevine_cdm.zip')
203-
cdm_platform = config.WIDEVINE_DOWNLOAD_MAP[self._arch][self._os]
204-
cdm_source = json.loads(self._http_request(config.WIDEVINE_CDM_SOURCE))['vendors']['gmp-widevinecdm']['platforms']
205-
cdm_zip_url = cdm_source[cdm_platform]['fileUrl']
207+
cdm_version = self._current_widevine_cdm_version()
208+
cdm_os = config.WIDEVINE_OS_MAP[self._os]
209+
cdm_arch = config.WIDEVINE_ARCH_MAP[self._arch][self._os]
210+
cdm_url = config.WIDEVINE_DOWNLOAD_URL.format(cdm_version, cdm_os, cdm_arch)
206211

207-
downloaded = self._http_request(cdm_zip_url, download=True, download_path=download_path)
212+
downloaded = self._http_request(cdm_url, download=True, download_path=download_path)
208213
if downloaded:
209214
if self._unzip_widevine_cdm(download_path):
210215
dialog.ok(self._language(30001), self._language(30003))

0 commit comments

Comments
 (0)