optic3importer

package module
v0.0.0-...-805bfde Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

README

ALGE Optic3.NET XML importer utility

Small Golang library and cmdline utility that parses and converts CSV heat series exported by the sports results app (Mantis) used by the Spanish Canoeing Federation (RFEP) and other autonomic federations to the XML format used by the ALGE timing cameras management software.

Building

This project requires Golang 1.21+, for setup instructions for your system see: https://go.dev/doc/install

Setup

First, clone the project and setup the module dependencies

# Clone the project
git clone https://github.com/angiglesias/optic3-importer.git
# Fetch and setup golang vendoring directory
go mod vendor
Linux

This is a pure Golang project, so building the project in linux is quite straighforward:

go build -v -ldflags "-s -w" -o convert cmd/convert/main.go

If you want a static binary for better compatibility accross Linux versions and distros build with CGO_ENABLED=0:

CGO_ENABLED go build -v -ldflags "-s -w" -o convert cmd/convert/main.go

To crosscompile the project for other systems and archs, include the GOOS and GOARCH env vars, as shown in here:

# Building the application for ARMv7 linux systems
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 -v -ldflags "-s -w" -o convert cmd/convert/main.go
Windows

Building the project for Windows is similar than in linux:

go build -v -ldflags "-s -w" -o convert.exe cmd/convert/main.go

Or crosscompiling for Windows on another system:

GOOS=windows go build -v -ldflags "-s -w" -o convert.exe cmd/convert/main.go

Use

The command line utility is pretty simple. Just point to a CSV file with the heat timetable as the one provided in HCESA.csv and pick the formatting options which suit you best:

$ ./convert --help
Usage of ./convert:
      --ext-names       Extended file names (default true)
      --grp-days        Grouped days
      --inc-index       Include heat order in name (default true)
  -i, --input string    Input CSV file with data to convert
  -o, --output string   Output XML file with conversion

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IncludeIndexInHeatName bool
	ExtendedHeatName       bool
	GroupDays              GroupDayMode
}

type Converter

type Converter interface {
	// Parse  will read raw data from a io.Reader and generate an alge XML meeting
	Parse(data io.Reader) ([]alge.Meet, error)
	// Conver will process a series of mantis Heats and will generate an alge XML meeting
	Convert(series []mantis.Heat) ([]alge.Meet, error)
}

func NewMantisConverter

func NewMantisConverter(cfg Config) Converter

type GroupDayMode

type GroupDayMode int
const (
	None       GroupDayMode = iota // All series in a single file
	SingleFile                     // Group heats by day under single file
	MultiFile                      // Group heats by day, with each day on a separate file
)

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL