Software /
code /
prosody
Diff
plugins/mod_scansion_record.lua @ 9364:62f9127ab493
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 22 Sep 2018 14:36:34 +0200 |
parent | 9363:c4ecaaf66e76 |
child | 9365:acb316319dc0 |
line wrap: on
line diff
--- 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);