Strip pre-2000 leading points to prevent epoch-zero start time and absurd duration
This commit is contained in:
@@ -6,7 +6,7 @@ from typing import Any
|
||||
|
||||
import fitdecode
|
||||
|
||||
from bincio.extract.models import DataPoint, LapData, ParsedActivity
|
||||
from bincio.extract.models import DataPoint, LapData, ParsedActivity, strip_bogus_leading_points
|
||||
from bincio.extract.sport import normalise_sport
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ class FitParser:
|
||||
)
|
||||
)
|
||||
|
||||
points = strip_bogus_leading_points(points)
|
||||
if not points:
|
||||
raise ValueError(f"No record messages found in {path.name}")
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
import gpxpy
|
||||
import gpxpy.gpx
|
||||
|
||||
from bincio.extract.models import DataPoint, ParsedActivity
|
||||
from bincio.extract.models import DataPoint, ParsedActivity, strip_bogus_leading_points
|
||||
from bincio.extract.parsers.base import BaseParser
|
||||
from bincio.extract.sport import normalise_sport, normalise_sub_sport
|
||||
|
||||
@@ -38,6 +38,7 @@ class GpxParser(BaseParser):
|
||||
_apply_extensions(pt, dp)
|
||||
points.append(dp)
|
||||
|
||||
points = strip_bogus_leading_points(points)
|
||||
if not points:
|
||||
raise ValueError(f"No trackpoints found in {path.name}")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from bincio.extract.models import DataPoint, ParsedActivity
|
||||
from bincio.extract.models import DataPoint, ParsedActivity, strip_bogus_leading_points
|
||||
from bincio.extract.sport import normalise_sport, normalise_sub_sport
|
||||
|
||||
_NS_HTTP = {
|
||||
@@ -73,6 +73,7 @@ class TcxParser:
|
||||
)
|
||||
points.append(dp)
|
||||
|
||||
points = strip_bogus_leading_points(points)
|
||||
if not points:
|
||||
raise ValueError(f"No trackpoints found in {path.name}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user