06/02/21 14:27:55 7kJsfR9x0
>>354 grepスレの質問のやつか? pythonだとこんなかんじでコマンドプロンプトのfor文で回す
""" thisfile.py file.m4a --> file_.m4a"""
import sys, os
import re
if __name__ == "__main__":
if len(sys.argv) == 2:
print "File size: " + str (os.stat(sys.argv[1]).st_size) + " Bytes"
fp = open (sys.argv[1], "rb")
data = fp.read()
m = re.compile(r"esds.{22}(.{8})\x05\x80{3}").search(data)
pos = m.start(1)
if pos != -1:
print "Tag Found! Position %d Byte" % pos
print "%r" % m.group(1)
output = sys.argv[1][:-4] + "_" + sys.argv[1][-4:]
out = open (output, "wb")
out.write (data[:pos])
# 8 bytes
out.write ("\x00\x02\x0a\xb0\x00\x01\xf4\x01")
out.write (data[pos+8:])
out.close ()
>>355