scripts: extend POTA/WWFF export script to handle SOTA as well

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 23 insertions(+), 12 deletions(-)

M scripts/export-pota-adif.lua
M scripts/export-pota-adif.lua +23 -12
@@ 166,7 166,7 @@ end
 local function do_add_entry(prog, signame, station, orig_qso, txref, rxref)
 	local basename = string.format("%s_%s_%s_%04u%02u%02u",
 				       orig_qso.tx.operator_call,
-				       txref,
+				       txref:gsub('/', '-'),
 				       orig_qso.tx.state,
 				       orig_qso.start_time.year,
 				       orig_qso.start_time.month,

          
@@ 175,13 175,18 @@ local function do_add_entry(prog, signam
 	-- get a writable copy
 	qso = orig_qso:clone()
 	hlog.nvl.clear(qso.additional)
-	if txref ~= nil then
-		qso.additional['my_sig'] = signame
-		qso.additional['my_sig_info'] = txref
-	end
-	if rxref ~= nil then
-		qso.additional['sig'] = signame
-		qso.additional['sig_info'] = rxref
+	if signame == "SOTA" then
+		qso.additional['my_sota_ref'] = txref
+		qso.additional['sota_ref'] = rxref
+	else
+		if txref ~= nil then
+			qso.additional['my_sig'] = signame
+			qso.additional['my_sig_info'] = txref
+		end
+		if rxref ~= nil then
+			qso.additional['sig'] = signame
+			qso.additional['sig_info'] = rxref
+		end
 	end
 
 	-- drop /P, /M, etc. from station call

          
@@ 293,12 298,12 @@ local function add_entry(qso, prog, sign
 	assert(txrefs ~= nil)
 
 	if not allow_multiple and tcount(txrefs) > 1 then
-		print(string.format("Warning: %s QSO with multiple tx WWFF references (%s)",
-				    qso.uuid, qso.additional['tx_wwff']))
+		print(string.format("Warning: %s QSO with multiple tx %s references (%s)",
+				    qso.uuid, signame, qso.additional[tx]))
 	end
 	if not allow_multiple and tcount(rxrefs) > 1 then
-		print(string.format("Warning: %s QSO multiple rx WWFF references",
-				    qso.uuid, qso.additional['rx_wwff']))
+		print(string.format("Warning: %s QSO multiple rx %s references (%s)",
+				    qso.uuid, signame, qso.additional[rx]))
 	end
 
 	for _, txref in ipairs(txrefs) do

          
@@ 581,12 586,18 @@ function main()
 		logs = {},
 		mangled_qso_to_orig = {},
 	}
+	local sota = {
+		logs = {},
+		mangled_qso_to_orig = {},
+	}
 
 	for qso in hlog.index.history(true) do
 		add_entry(qso, pota, 'POTA', 'tx_pota', 'rx_pota', 'pota_log_submitted', true)
 		add_entry(qso, wwff, 'WWFF', 'tx_wwff', 'rx_wwff', 'wwff_log_submitted', false)
+		add_entry(qso, sota, 'SOTA', 'tx_sota', 'rx_sota', 'sota_log_submitted', false)
 	end
 
 	gen_logs(pota, 'POTA')
 	gen_logs(wwff, 'WWFF')
+	gen_logs(sota, 'SOTA')
 end