Skip to content

Commit 4fc3f3f

Browse files
Prompt for the Widevine EULA
1 parent bff4f2c commit 4fc3f3f

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

lib/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868

6969
WIDEVINE_DOWNLOAD_URL = 'https://dl.google.com/widevine-cdm/{0}-{1}-{2}.zip'
7070

71+
WIDEVINE_LICENSE_FILE = 'LICENSE.txt'
72+
7173
CHROMEOS_RECOVERY_CONF = 'https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf'
7274

7375
CHROMEOS_ARM_HWID = 'SPRING'

lib/inputstreamhelper.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,13 @@ def _install_widevine_cdm_x86(self):
321321
busy_dialog = xbmcgui.DialogBusy()
322322
busy_dialog.create()
323323
self._unzip_cdm()
324-
self._install_cdm()
324+
if self._widevine_eula():
325+
self._install_cdm()
326+
else:
327+
self._cleanup()
328+
return False
325329
self._cleanup()
330+
326331
if self._has_widevine_cdm():
327332
dialog.ok(self._language(30001), self._language(30003))
328333
busy_dialog.close()
@@ -338,7 +343,7 @@ def _install_widevine_cdm_arm(self):
338343
download_dict = self._parse_chromeos_recovery_conf()
339344
self._url = download_dict['url']
340345

341-
if dialog.yesno(self._language(30001), self._language(30002)) and dialog.yesno(self._language(30001), self._language(30006).format(self.sizeof_fmt(download_dict['required_diskspace']))):
346+
if dialog.yesno(self._language(30001), self._language(30002)) and dialog.yesno(self._language(30001), self._language(30006).format(self.sizeof_fmt(download_dict['required_diskspace']))) and self._widevine_eula():
342347
if self._os != 'Linux':
343348
dialog.ok(self._language(30004), self._language(30019).format(self._os))
344349
return False
@@ -378,6 +383,22 @@ def _install_widevine_cdm_arm(self):
378383

379384
return False
380385

386+
def _widevine_eula(self):
387+
"""Displays the Widevine EULA."""
388+
if os.path.exists(os.path.join(self._cdm_path(), config.WIDEVINE_LICENSE_FILE)):
389+
license_file = os.path.join(self._cdm_path(), config.WIDEVINE_LICENSE_FILE)
390+
with open(license_file, 'r') as f:
391+
eula = f.read().strip().replace('\n', ' ')
392+
else: # grab the license from the x86 files
393+
self._url = config.WIDEVINE_DOWNLOAD_URL.format(self._current_widevine_cdm_version(), 'linux', 'x64')
394+
self._http_request(download=True, message=self._language(30025))
395+
with zipfile.ZipFile(self._download_path) as z:
396+
with z.open(config.WIDEVINE_LICENSE_FILE) as f:
397+
eula = f.read().strip().replace('\n', ' ')
398+
399+
dialog = xbmcgui.Dialog()
400+
return dialog.yesno(self._language(30026), eula, yeslabel=self._language(30027), nolabel=self._language(30028))
401+
381402
def _extract_cdm_from_img(self):
382403
"""Extract the Widevine CDM binary from the mounted Chrome OS image."""
383404
for root, dirs, files in os.walk(self._mnt_path()):

resources/language/resource.language.en_gb/strings.po

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,19 @@ msgstr ""
108108
msgctxt "#30024"
109109
msgid "The installation now needs to unzip, mount and extract [B]Widevine DRM[/B] from the recovery image.[CR][CR]This process may take up to five minutes to complete."
110110
msgstr ""
111+
112+
msgctxt "#30025"
113+
msgid "Acquiring EULA."
114+
msgstr ""
115+
116+
msgctxt "#30026"
117+
msgid "Widevine DRM EULA"
118+
msgstr ""
119+
120+
msgctxt "#30027"
121+
msgid "I accept"
122+
msgstr ""
123+
124+
msgctxt "#30028"
125+
msgid "Cancel"
126+
msgstr ""

0 commit comments

Comments
 (0)