comprime/decompr.py
2025-06-17 15:30:36 +02:00

30 lines
756 B
Python
Executable file

#!/usr/bin/env -S python3
import subprocess
import sys
def main():
[_, input] = sys.argv
input_tar = input.replace(".cprmt", ".tar")
output = input_tar.replace(".tar", "")
print("Decompressing '" + input + "' into '" + output + "'.")
input_fd = open(input, "rb")
output_tar_fd = open(input_tar, "wb")
byte_index = 0
while True:
read = input_fd.read(1024)
if len(read) == 0:
break
for byte in read:
if byte_index == 0:
pass
else:
output_tar_fd.write(bytes([byte]))
byte_index += 1
byte_index %= 5
subprocess.Popen(["tar", "xf", input_tar]).wait()
print("Done.")
if __name__ == "__main__": main()