def worker_thread(job_queue: Queue, signal_update: Signal): while True: xls_filepath: pathlib.Path xls_filepath = job_queue.get(block=True) df = DataImporter.xls_import(xls_filepath) for idx, col in enumerate(df.columns): if col[0:7] != 'Unnamed': ds = DataSeries(df, idx, col) ds.report() signal_update.emit(ds.report_list)
def backup(self, out_dir: Union[Path, str], progress: Signal = None): """ Create a full untouched (but decrypted) ISO backup of a DVD with all metadata intact. Parameters: out_dir: Directory to store the backup. progress: Signal to emit progress updates to. Raises: SlipstreamNoKeysObtained if no CSS keys were obtained when needed. SlipstreamReadError on unexpected read errors. """ self.log.info("Starting DVD backup for %s" % self.device) fn = Path(out_dir) / ("%s.ISO.!ss" % self.cdlib.pvd.volume_identifier.replace(b"\x00", b"").strip().decode()) first_lba = 0 # lba values are 0-indexed current_lba = first_lba last_lba = self.cdlib.pvd.space_size - 1 disc_size = self.cdlib.pvd.log_block_size * self.cdlib.pvd.space_size self.log.debug( f"Reading sectors {first_lba:,} to {last_lba:,} with sector size {self.cdlib.pvd.log_block_size:,} B.\n" f"Length: {last_lba + 1:,} sectors, {disc_size:,} bytes.\n" f'Saving to "{fn.with_suffix("")}"...' ) if self.dvdcss.is_scrambled(): self.log.debug("DVD is scrambled. Checking if all CSS keys can be cracked. This might take a while.") self.vob_lba_offsets = self.get_vob_lbas(crack_keys=True) if not self.vob_lba_offsets: raise SlipstreamNoKeysObtained("No CSS title keys were returned, unable to decrypt.") else: self.log.debug("DVD isn't scrambled. CSS title key cracking skipped.") f = fn.open("wb") t = tqdm(total=last_lba + 1, unit="sectors") while current_lba <= last_lba: data = self.read(current_lba, min(self.dvdcss.BLOCK_BUFFER, last_lba - current_lba + 1)) f.write(data) read_sectors = len(data) // self.cdlib.pvd.log_block_size current_lba += read_sectors if progress: progress.emit((current_lba / last_lba) * 100) t.update(read_sectors) f.close() t.close() fn = fn.replace(fn.with_suffix("")) self.log.info( "Finished DVD Backup!\n" f"Read a total of {current_lba:,} sectors ({os.path.getsize(fn):,}) bytes.\n" )