From 3a1bd1185f87cf133321a90b0c0616bf68cc16c6 Mon Sep 17 00:00:00 2001 From: Tomasz Sobczyk Date: Sat, 5 Dec 2020 15:00:02 +0100 Subject: [PATCH] Add binpack coarse shuffle tool. --- script/shuffle_binpack.py | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 script/shuffle_binpack.py diff --git a/script/shuffle_binpack.py b/script/shuffle_binpack.py new file mode 100644 index 00000000..409d4907 --- /dev/null +++ b/script/shuffle_binpack.py @@ -0,0 +1,69 @@ +import struct +import sys +import os +import random +from pathlib import Path + +def index_binpack(file): + print('Indexing...') + index = [] + offset = 0 + report_every = 100 + prev_mib = -report_every + while file.peek(): + chunk_header = file.read(8) + assert chunk_header[0:4] == b'BINP' + size = struct.unpack('