def md5_contents(filename): m = Multifile() m.openRead(filename) payload = [] for i in range(m.getNumSubfiles()): payload.append(m.get_subfile_name(i)) m.close() return payload
def test_multifile_read_empty(): stream = StringStream(b'pmf\x00\n\r\x01\x00\x01\x00\x01\x00\x00\x00\xdb\x9d7\\\x00\x00\x00\x00') wrapper = IStreamWrapper(stream) m = Multifile() assert m.open_read(wrapper) assert m.is_read_valid() assert m.get_num_subfiles() == 0 m.close()
def test_multifile_read_empty(): stream = StringStream( b'pmf\x00\n\r\x01\x00\x01\x00\x01\x00\x00\x00\xdb\x9d7\\\x00\x00\x00\x00' ) wrapper = IStreamWrapper(stream) m = Multifile() assert m.open_read(wrapper) assert m.is_read_valid() assert m.get_num_subfiles() == 0 m.close()
def crea_mf(name): name_r = name + "_r" + str(sys.argv[1]) if os.path.exists("arcns_mfs/" + name_r + ".mf"): if os.stat(name).st_mtime <= os.stat("arcns_mfs/" + name_r + ".mf").st_mtime: return else: os.unlink("arcns_mfs/" + name_r + ".mf") mf = Multifile() mf.openWrite("arcns_mfs/" + name_r + ".mf") for root, dirs, files in os.walk(name): for f in files: if f[-1] == "~" or f[-3:] == "pyc" or f[-3:] == "pyo" or f[ -3:] == "bam": pass elif f[-2:] == "py": if os.path.exists(f + "o") and os.stat(f).st_mtime <= os.stat( f + "o").st_mtime: pass else: py_compile.compile(root + "/" + f) fln = Filename(root + "/" + f + "o") fln.set_binary() mf.addSubfile(root + "/" + f + "o", fln, 6) elif f[-3:] == "egg": if os.path.exists(root + "/" + f[:-3] + "bam") and os.stat( root + "/" + f).st_mtime <= os.stat( root + "/" + f[:-3] + "bam").st_mtime: pass else: if os.path.exists(root + "/" + f[:-3] + "bam"): os.unlink(root + "/" + f[:-3] + "bam") os.system("egg2bam -o " + root + "/" + f[:-3] + "bam " + root + "/" + f) fln = Filename(root + "/" + f[:-3] + "bam") fln.set_binary() mf.addSubfile(root + "/" + f[:-3] + "bam", fln, 6) elif f[-3:] == "wav": fln = Filename(root + "/" + f) fln.set_binary() mf.addSubfile(root + "/" + f, fln, 6) mf.close()