fietsboek.convert module

Conversion functions to convert between various recording formats.

exception fietsboek.convert.ConversionError

Bases: Exception

Error that occurred when loading a track from a file.

fietsboek.convert.from_fit(data)

Reads a .fit as track data.

This uses the fitparse library under the hood.

Parameters:

data (bytes) – The input bytes.

Return type:

Track

Returns:

The converted structure.

Raises:

ConversionError – If conversion failed.

fietsboek.convert.from_gpx(data)

Reads a .gpx as track data.

This uses the gpxpy library under the hood.

Parameters:

data (bytes) – The input bytes.

Return type:

Track

Returns:

The converted structure.

Raises:

ConversionError – If conversion failed.

fietsboek.convert.smart_convert(data)

Tries to be smart in converting the input bytes.

This function automatically applies the correct conversion if possible.

Note that this function is not guaranteed to return valid GPX bytes. In the worst case, invalid bytes are simply passed through.

Parameters:

data (bytes) – The input bytes.

Return type:

Track

Returns:

The converted content.

Raises:

ConversionError – When conversion fails.