def install_widevine(): try: download() oe.notify('Chromium', 'Extracting libwidevinecdm.so') if not os.path.isdir(__tmp__ + __tar__): oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__) oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1]) oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded') except Exception, e: oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
def install_flash(): try: download() oe.notify('Chromium', 'Extracting libpepflashplayer.so') if not os.path.isdir(__tmp__ + __tar__): oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __flash__) if not os.path.isdir(__path__ + 'PepperFlash'): os.mkdir(__path__ + 'PepperFlash') oe.copy_file(__tmp__ + __flash__, __path__ + 'PepperFlash/' + __flash__.split('/')[-1]) oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded') except Exception, e: oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
def install_flash(): __url__ = 'https://fpdownload.adobe.com/pub/flashplayer/pdc/24.0.0.186/flash_player_ppapi_linux.x86_64.tar.gz' __file__ = __url__.split('/')[-1] __tmp__ = '/tmp/pepperflash/' __lib__ = 'libpepflashplayer.so' try: if not os.path.isdir(__tmp__): os.mkdir(__tmp__) if not os.path.exists(__tmp__ + __file__): oe.download_file(__url__, __tmp__ + __file__) if not os.path.exists(__tmp__ + __file__): oe.notify('Chromium', 'Could not download file') else: oe.notify('Chromium', 'Extracting libpepflashplayer.so') if not os.path.isdir(__tmp__ + __file__): oe.execute('tar zxf ' + __tmp__ + __file__ + ' -C ' + __tmp__ + '') if not os.path.isdir(__path__ + 'PepperFlash'): os.mkdir(__path__ + 'PepperFlash') oe.copy_file(__tmp__ + __lib__, __path__ + 'PepperFlash/' + __lib__) oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded') except Exception, e: oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
def install_widevine(): __url__ = 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb' __file__ = __url__.split('/')[-1] __tar__ = 'data.tar.xz' __tmp__ = '/tmp/widevine/' __lib__ = 'opt/google/chrome/libwidevinecdm.so' try: if not os.path.isdir(__tmp__): os.mkdir(__tmp__) if not os.path.exists(__tmp__ + __file__): oe.download_file(__url__, __tmp__ + __file__) if not os.path.exists(__tmp__ + __file__): oe.notify('Chromium', 'Could not download file') else: oe.notify('Chromium', 'Extracting libwidevinecdm.so') if not os.path.isdir(__tmp__ + __tar__): oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__) oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1]) oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded') except Exception, e: oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
def do_restore(self, listItem=None): copy_success = 0 restore_file_path = xbmcDialog.browse(1, oe._(32373), 'files', '??????????????.tar', False, False, self.BACKUP_DESTINATION) # Do nothing if the dialog is cancelled - path will be the backup destination if not os.path.isfile(restore_file_path): return log.log(f'Restore file: {restore_file_path}', log.INFO) restore_file_name = restore_file_path.split('/')[-1] if os.path.exists(self.RESTORE_DIR): oe.execute(f'rm -rf {self.RESTORE_DIR}') os.makedirs(self.RESTORE_DIR) folder_stat = os.statvfs(self.RESTORE_DIR) file_size = os.path.getsize(restore_file_path) free_space = folder_stat.f_frsize * folder_stat.f_bavail if free_space > file_size * 2: if os.path.exists(self.RESTORE_DIR + restore_file_name): os.remove(self.RESTORE_DIR + restore_file_name) if oe.copy_file(restore_file_path, self.RESTORE_DIR + restore_file_name) != None: copy_success = 1 log.log('Restore file successfully copied.', log.INFO) else: log.log(f'Failed to copy restore file to: {self.RESTORE_DIR}', log.ERROR) oe.execute(f'rm -rf {self.RESTORE_DIR}') else: txt = oe.split_dialog_text(oe._(32379)) answer = xbmcDialog.ok('Restore', f'{txt[0]}\n{txt[1]}\n{txt[2]}') if copy_success == 1: txt = oe.split_dialog_text(oe._(32380)) answer = xbmcDialog.yesno('Restore', f'{txt[0]}\n{txt[1]}\n{txt[2]}') if answer == 1: if oe.reboot_counter(10, oe._(32371)) == 1: oe.winOeMain.close() oe.xbmcm.waitForAbort(1) subprocess.call( ['/usr/bin/systemctl', '--no-block', 'reboot'], close_fds=True) else: log.log('User Abort!') oe.execute(f'rm -rf {self.RESTORE_DIR}')
def do_restore(self, listItem=None): copy_success = 0 restore_file_path = xbmcDialog.browse(1, oe._(32373), 'files', '??????????????.tar', False, False, self.BACKUP_DESTINATION) # Do nothing if the dialog is cancelled - path will be the backup destination if not os.path.isfile(restore_file_path): return restore_file_name = restore_file_path.split('/')[-1] if os.path.exists(self.RESTORE_DIR): oe.execute('rm -rf %s' % self.RESTORE_DIR) os.makedirs(self.RESTORE_DIR) folder_stat = os.statvfs(self.RESTORE_DIR) file_size = os.path.getsize(restore_file_path) free_space = folder_stat.f_frsize * folder_stat.f_bavail if free_space > file_size * 2: if os.path.exists(self.RESTORE_DIR + restore_file_name): os.remove(self.RESTORE_DIR + restore_file_name) if oe.copy_file(restore_file_path, self.RESTORE_DIR + restore_file_name) != None: copy_success = 1 else: oe.execute(f'rm -rf {self.RESTORE_DIR}') else: txt = oe.split_dialog_text(oe._(32379)) answer = xbmcDialog.ok('Restore', f'{txt[0]}\n{txt[1]}\n{txt[2]}') if copy_success == 1: txt = oe.split_dialog_text(oe._(32380)) answer = xbmcDialog.yesno('Restore', f'{txt[0]}\n{txt[1]}\n{txt[2]}') if answer == 1: if oe.reboot_counter(10, oe._(32371)) == 1: oe.winOeMain.close() oe.xbmcm.waitForAbort(1) xbmc.executebuiltin('Reboot') else: log.log('User Abort!') oe.execute(f'rm -rf {self.RESTORE_DIR}')