Loading scripts/cut_bs.py +0 −21 Original line number Diff line number Diff line Loading @@ -38,27 +38,6 @@ import sys SID_BITS = {35, 48, 104} SYNC_WORDS = {b"!k", b" k"} def cut_to_length(fp, fp_out, length): assert length > 0 fr_cnt = 0 for f in range(length): sync_word = fp.read(2) if sync_word == b"": return fr_cnt if sync_word not in SYNC_WORDS: raise ValueError("Bad Sync word!") n_bits_bs = fp.read(2) n_bits = struct.unpack("h", n_bits_bs)[0] fp_out.write(sync_word) fp_out.write(n_bits_bs) fp_out.write(fp.read(n_bits * 2)) fr_cnt += 1 return fr_cnt def cut_from_start(fp, fp_out, start_frame=0, length=-1, start_with_sid=False): # cut until start frame fr_cnt = 0 Loading Loading
scripts/cut_bs.py +0 −21 Original line number Diff line number Diff line Loading @@ -38,27 +38,6 @@ import sys SID_BITS = {35, 48, 104} SYNC_WORDS = {b"!k", b" k"} def cut_to_length(fp, fp_out, length): assert length > 0 fr_cnt = 0 for f in range(length): sync_word = fp.read(2) if sync_word == b"": return fr_cnt if sync_word not in SYNC_WORDS: raise ValueError("Bad Sync word!") n_bits_bs = fp.read(2) n_bits = struct.unpack("h", n_bits_bs)[0] fp_out.write(sync_word) fp_out.write(n_bits_bs) fp_out.write(fp.read(n_bits * 2)) fr_cnt += 1 return fr_cnt def cut_from_start(fp, fp_out, start_frame=0, length=-1, start_with_sid=False): # cut until start frame fr_cnt = 0 Loading