@@ -173,22 +173,18 @@ def _http_request(self, download=False, message=None):
173
173
"""Makes HTTP request and displays a progress dialog on download."""
174
174
self ._log ('Request URL: {0}' .format (self ._url ))
175
175
filename = self ._url .split ('/' )[- 1 ]
176
- busy_dialog = xbmcgui .DialogBusy ()
177
176
dialog = xbmcgui .Dialog ()
178
177
179
178
try :
180
- busy_dialog .create ()
181
179
req = requests .get (self ._url , stream = download , verify = False )
182
180
self ._log ('Response code: {0}' .format (req .status_code ))
183
181
if not download :
184
182
self ._log ('Response: {0}' .format (req .content ))
185
183
req .raise_for_status ()
186
184
except requests .exceptions .HTTPError :
187
- busy_dialog .close ()
188
185
dialog .ok (self ._language (30004 ), self ._language (30013 ).format (filename ))
189
186
return False
190
187
191
- busy_dialog .close ()
192
188
if download :
193
189
if not message : # display "downloading [filename]"
194
190
message = self ._language (30015 ).format (filename )
@@ -322,13 +318,17 @@ def _install_widevine_cdm_x86(self):
322
318
323
319
downloaded = self ._http_request (download = True )
324
320
if downloaded :
321
+ busy_dialog = xbmcgui .DialogBusy ()
322
+ busy_dialog .create ()
325
323
self ._unzip_cdm ()
326
324
self ._install_cdm ()
327
325
self ._cleanup ()
328
326
if self ._has_widevine_cdm ():
329
327
dialog .ok (self ._language (30001 ), self ._language (30003 ))
328
+ busy_dialog .close ()
330
329
return True
331
330
else :
331
+ busy_dialog .close ()
332
332
dialog .ok (self ._language (30004 ), self ._language (30005 ))
333
333
334
334
return False
@@ -358,40 +358,39 @@ def _install_widevine_cdm_arm(self):
358
358
downloaded = self ._http_request (download = True , message = self ._language (30022 ))
359
359
if downloaded :
360
360
dialog .ok (self ._language (30023 ), self ._language (30024 ))
361
+ busy_dialog = xbmcgui .DialogBusy ()
362
+ busy_dialog .create ()
361
363
if not self ._unzip_bin () or not self ._losetup () or not self ._mnt_loop_dev ():
362
364
self ._cleanup ()
365
+ busy_dialog .close ()
363
366
return False
364
367
else :
365
368
self ._extract_cdm_from_img ()
366
369
self ._install_cdm ()
367
370
self ._cleanup ()
368
371
if self ._has_widevine_cdm ():
369
372
dialog .ok (self ._language (30001 ), self ._language (30003 ))
373
+ busy_dialog .close ()
370
374
return True
371
375
else :
376
+ busy_dialog .close ()
372
377
dialog .ok (self ._language (30004 ), self ._language (30005 ))
373
378
374
379
return False
375
380
376
381
def _extract_cdm_from_img (self ):
377
- busy_dialog = xbmcgui .DialogBusy ()
378
- busy_dialog .create ()
379
382
"""Extract the Widevine CDM binary from the mounted Chrome OS image."""
380
383
for root , dirs , files in os .walk (self ._mnt_path ()):
381
384
for filename in files :
382
385
if 'widevinecdm' in filename and filename .endswith (config .CDM_EXTENSIONS ):
383
386
shutil .copyfile (os .path .join (root , filename ), os .path .join (self ._cdm_path (), filename ))
384
- busy_dialog .close ()
385
387
return True
386
388
387
- busy_dialog .close ()
388
389
self ._log ('Failed to find Widevine CDM binary in Chrome OS image.' )
389
390
return False
390
391
391
392
def _install_cdm (self ):
392
393
"""Loop through local cdm folder and symlink/copy binaries to inputstream cdm_path."""
393
- busy_dialog = xbmcgui .DialogBusy ()
394
- busy_dialog .create ()
395
394
for cdm_file in os .listdir (self ._cdm_path ()):
396
395
if cdm_file .endswith (config .CDM_EXTENSIONS ):
397
396
cdm_path_addon = os .path .join (self ._cdm_path (), cdm_file )
@@ -401,32 +400,23 @@ def _install_cdm(self):
401
400
else :
402
401
os .symlink (cdm_path_addon , cdm_path_inputstream )
403
402
404
- busy_dialog .close ()
405
403
return True
406
404
407
405
def _unzip_bin (self ):
408
- busy_dialog = xbmcgui .DialogBusy ()
409
406
zip_obj = zipfile .ZipFile (self ._download_path )
410
- busy_dialog .create ()
411
407
for filename in zip_obj .namelist ():
412
408
if filename .endswith ('.bin' ):
413
409
zip_obj .extract (filename , self ._temp_path ())
414
- busy_dialog .close ()
415
410
self ._bin_path = os .path .join (self ._temp_path (), filename )
416
411
return True
417
412
418
413
def _unzip_cdm (self ):
419
- busy_dialog = xbmcgui .DialogBusy ()
420
- busy_dialog .create ()
421
414
zip_obj = zipfile .ZipFile (self ._download_path )
422
415
zip_obj .extractall (self ._cdm_path ())
423
- busy_dialog .close ()
424
416
return True
425
417
426
418
def _cleanup (self ):
427
419
"""Clean up after Widevine DRM installation."""
428
- busy_dialog = xbmcgui .DialogBusy ()
429
- busy_dialog .create ()
430
420
if self ._mounted :
431
421
cmd = ['umount' , self ._mnt_path ()]
432
422
subprocess .check_call (cmd )
@@ -437,7 +427,6 @@ def _cleanup(self):
437
427
self ._loop_dev = False
438
428
439
429
shutil .rmtree (self ._temp_path ())
440
- busy_dialog .close ()
441
430
return True
442
431
443
432
def _supports_hls (self ):
0 commit comments