diff --git a/pymule/vegas.py b/pymule/vegas.py index ce46ba42709c8310d1d25da3ead66378fb61cc3d..4df798c9a5e1e9b12d573f7cbdf1fff4d36b1cd6 100644 --- a/pymule/vegas.py +++ b/pymule/vegas.py @@ -21,6 +21,20 @@ def read_record(fp, typ): return body +def write_record(fp, typ, content): + if type(content) == str and len(content) > 1: + content = list(content) + elif type(content) != list: + content = [content] + + body = "".join( + struct.pack("<"+typ, i) for i in content + ) + fp.write(struct.pack('<I', len(body))) + fp.write(body) + fp.write(struct.pack('<I', len(body))) + + def guess_version(fp, inttype='i'): fp.seek(0) magic = fp.read(17).replace('\00', '')