def __init__(self): try: self.wd = xbmcgui.DialogBusy() self.wd.create() self.update(0) except: busy()
def __init__(self): try: self.wd = xbmcgui.DialogBusy() self.wd.create() self.update(0) except: xbmc.executebuiltin('ActivateWindow(busydialog)')
def _install_widevine_x86(self): """Install Widevine CDM on x86 based architectures.""" dialog = xbmcgui.Dialog() cdm_version = self._latest_widevine_version() if self._legacy( ): # google has a different naming scheme on older widevine versions cdm_version = cdm_version.split('.')[-1] cdm_os = config.WIDEVINE_OS_MAP[self._os()] cdm_arch = config.WIDEVINE_ARCH_MAP_X86[self._arch()] self._url = config.WIDEVINE_DOWNLOAD_URL.format( cdm_version, cdm_os, cdm_arch) downloaded = self._http_request(download=True) if downloaded: busy_dialog = xbmcgui.DialogBusy() busy_dialog.create() self._unzip(self._addon_cdm_path()) if self._widevine_eula(): self._install_cdm() self._cleanup() else: self._cleanup() return False if self._has_widevine(): if os.path.lexists(self._widevine_config_path()): os.remove(self._widevine_config_path()) os.rename( os.path.join(self._addon_cdm_path(), config.WIDEVINE_MANIFEST_FILE), self._widevine_config_path()) wv_check = self._check_widevine() if wv_check: dialog.notification(LANGUAGE(30037), LANGUAGE(30003)) busy_dialog.close() return wv_check else: busy_dialog.close() dialog.ok(LANGUAGE(30004), LANGUAGE(30005)) return False
def _install_widevine_arm(self): """Installs Widevine CDM on ARM-based architectures.""" root_cmds = ['mount', 'umount', 'losetup', 'modprobe'] cos_config = self._chromeos_config() device = [ x for x in cos_config if config.CHROMEOS_ARM_HWID in x['hwidmatch'] ][0] required_diskspace = int(device['filesize']) + int( device['zipfilesize']) dialog = xbmcgui.Dialog() if dialog.yesno( LANGUAGE(30001), LANGUAGE(30006).format(self._sizeof_fmt( required_diskspace))) and self._widevine_eula(): if self._os() != 'Linux': dialog.ok(LANGUAGE(30004), LANGUAGE(30019).format(self._os())) return False if required_diskspace >= self._diskspace(): dialog.ok( LANGUAGE(30004), LANGUAGE(30018).format( self._sizeof_fmt(required_diskspace))) return False if not self._cmd_exists('fdisk') and not self._cmd_exists( 'parted'): dialog.ok(LANGUAGE(30004), LANGUAGE(30020).format('fdisk', 'parted')) return False if not self._cmd_exists('mount'): dialog.ok(LANGUAGE(30004), LANGUAGE(30021).format('mount')) return False if not self._cmd_exists('losetup'): dialog.ok(LANGUAGE(30004), LANGUAGE(30021).format('losetup')) return False if os.getuid() != 0: # ask for permissions to run cmds as root if not dialog.yesno(LANGUAGE(30001), LANGUAGE(30030).format( ', '.join(root_cmds)), yeslabel=LANGUAGE(30027), nolabel=LANGUAGE(30028)): return False self._url = device['url'] downloaded = self._http_request(download=True, message=LANGUAGE(30022)) if downloaded: dialog.ok(LANGUAGE(30023), LANGUAGE(30024)) busy_dialog = xbmcgui.DialogBusy() busy_dialog.create() bin_filename = self._url.split('/')[-1].replace('.zip', '') bin_path = os.path.join(self._temp_path(), bin_filename) success = [ self._unzip(self._temp_path(), bin_filename), self._check_loop(), self._set_loop_dev(), self._losetup(bin_path), self._mnt_loop_dev() ] if all(success): self._extract_widevine_from_img() self._install_cdm() self._cleanup() if self._has_widevine(): with open(self._widevine_config_path(), 'w') as config_file: config_file.write(json.dumps(cos_config, indent=4)) dialog.notification(LANGUAGE(30037), LANGUAGE(30003)) busy_dialog.close() wv_check = self._check_widevine() if wv_check: dialog.notification(LANGUAGE(30037), LANGUAGE(30003)) busy_dialog.close() return wv_check else: busy_dialog.close() dialog.ok(LANGUAGE(30004), LANGUAGE(30005)) else: self._cleanup() busy_dialog.close() dialog.ok(LANGUAGE(30004), LANGUAGE(30005)) return False