xml report

This commit is contained in:
nuknal
2024-05-22 11:31:08 +08:00
parent 0634b0106e
commit eb6e0bc95a
6 changed files with 93 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"math"
"os"
"path/filepath"
"strings"
"time"
@@ -198,7 +199,28 @@ func (e *Extractor) SeprateAuxAndImgData(dataFile string, segmentIndex int) erro
lw.ws[AUX].w.Write(platAux[i*512 : (i+1)*512])
}
e.ExtractAux(lw.ws[AUX].name, lw.ws[AUX].name+".xlsx")
_, _, aps, err := e.ExtractAux(lw.ws[AUX].name, lw.ws[AUX].name+".xlsx")
if err != nil {
return err
}
e.mutex.Lock()
defer e.mutex.Unlock()
seg := Segment{
Pan: lw.ws[PAN_RAW].name,
Mss: lw.ws[MSS_RAW].name,
Aux: lw.ws[AUX].name,
Id: strings.Split(filepath.Base(lw.ws[AUX].name), ".")[0],
StartTime: XMLTime{
TimeZone: "UTC",
Value: time.Unix(int64(aps[0].UTCTimeSec)+int64(ReferenceTime2000), int64(aps[0].Microsecond)*1000).UTC().Format(time.RFC3339),
},
EndTime: XMLTime{
TimeZone: "UTC",
Value: time.Unix(int64(aps[len(aps)-1].UTCTimeSec)+int64(ReferenceTime2000), int64(aps[len(aps)-1].Microsecond)*1000).UTC().Format(time.RFC3339),
},
}
e.report.Segments = append(e.report.Segments, seg)
return nil
}