# HG changeset patch # User Kim Alvefur # Date 1537619794 -7200 # Node ID 62f9127ab493ba72ed17bf81a878b4679bd8b3a7 # Parent c4ecaaf66e765bb297fbfa7f8609b1bb09662153 mod_scansion_record: Open a related file for header entries Since It's tricky to go back and insert data at the beginning of a file, but `cat blah.sch blah.scs` ought to be fine for now. diff -r c4ecaaf66e76 -r 62f9127ab493 plugins/mod_scansion_record.lua --- a/plugins/mod_scansion_record.lua Sat Sep 22 14:30:10 2018 +0200 +++ b/plugins/mod_scansion_record.lua Sat Sep 22 14:36:34 2018 +0200 @@ -10,14 +10,20 @@ local record_id = id.medium():lower(); local record_date = os.date("%Y%b%d"):lower(); +local header_file = dm.getpath(record_id, "scansion", record_date, "sch", true); local record_file = dm.getpath(record_id, "scansion", record_date, "scs", true); +local head = io.open(header_file, "w"); local scan = io.open(record_file, "w"); local function record(string) scan:write(string); end +local function record_header(string) + head:write(string); +end + local function record_event(session, event) record(session.scansion_id.." "..event.."\n\n"); end @@ -74,4 +80,5 @@ module:hook_global("server-stopping", function () module:log("info", "Scansion recording available in %s", record_file); scan:close(); + head:close() end);