def getFile(self, uid): """""" # ~ Sys.pwlog([(Const.LINE_SEP_CHAR*Const.LINE_SEP_LEN , Const.CLZ_0, True)]) done = False key = self.idxu.index.getById(uid) row = self.idxu.index.get(key) filePath = None try: if row is not None: account = self.idxu.switchFileAccount(row[self.idxu.index.ACCOUNT]) km = Kirmah(row[self.idxu.index.KEY]) hlst = km.ck.getHashList(key, row[self.idxu.index.PARTS], True) ids = self.idxu.ih.searchBySubject(hlst["head"][2], True) Sys.cli_emit_progress(0) Sys.sleep(0.2) Sys.pwlog( [ (" Downloading : ", Const.CLZ_7), (row[self.idxu.index.LABEL] + row[self.idxu.index.EXT], Const.CLZ_2), (" (", Const.CLZ_0), (Sys.readableBytes(row[self.idxu.index.SIZE]), Const.CLZ_3), (")", Const.CLZ_0), (" please wait...", Const.CLZ_7, True), ] ) if len(ids) >= row[self.idxu.index.PARTS]: self.getFileParts(row, ids) Sys.pwlog([(" Merging parts...", Const.CLZ_7, True)]) Sys.cli_emit_progress(0) Sys.sleep(0.2) filePath = km.merge( hlst, self.deploy + row[self.idxu.index.CATG] + Sys.sep + row[self.idxu.index.LABEL], ext=row[self.idxu.index.EXT], uid=row[self.idxu.index.UID], dirs=self.inbox, ) Sys.pwlog( [ (" Deployed as ", Const.CLZ_7), (filePath, Const.CLZ_2), (" (", Const.CLZ_0), (Sys.readableBytes(Sys.getsize(filePath)), Const.CLZ_3), (") ", Const.CLZ_0, True), (" Checking integrity...", Const.CLZ_7, True), ] ) Sys.sleep(0.2) sha256 = hash_sha256_file(filePath) done = sha256 == row[ImpraIndex.HASH] done = True else: print("incomplete") except Exception as e: print(e) Sys.pwlog([(" done" if done else "ko", Const.CLZ_2 if done else Const.CLZ_1, True)]) return done, filePath