22import logging
33import sys
44import time
5+ from pathlib import Path
56
67from firome import __version__
8+ from firome .codecs .fit import parse_fit
9+ from firome .codecs .gpx import interpolate , parse_gpx
710from firome .codecs .tcx import export_as_tcx
811from firome .logger import LOGGER
912from firome .merge import merge
@@ -16,10 +19,10 @@ def __no_prio_args():
1619parser = argparse .ArgumentParser (
1720 description = "Combines GPX file with training data with GPX file with position data based on the distance" ,
1821)
19- parser .add_argument ("--route" , type = str , required = __no_prio_args (),
20- help = "Path to GPX file with route of the training" )
21- parser . add_argument ( "--recording" , type = str , required = __no_prio_args (),
22- help = "Path to FIT file with GPS-less data of the training" )
22+ parser .add_argument ("--route" , type = Path , required = __no_prio_args (), help = "Path to GPX file with route of the training" )
23+ parser . add_argument (
24+ "--recording" , type = Path , required = __no_prio_args (), help = "Path to FIT file with GPS-less data of the training" ,
25+ )
2326parser .add_argument ("--precision" , type = float , default = 1.0 , help = "Precision of interpolation, meters" )
2427parser .add_argument ("--output" , choices = ["tcx" ], default = "tcx" , help = "Output format" )
2528parser .add_argument ("--debug" , action = "store_true" , help = "Enable debug logging" )
@@ -29,7 +32,8 @@ def __no_prio_args():
2932 args = parser .parse_args ()
3033
3134 if args .version :
32- print (__version__ ) # noqa: T201 # not for debug
35+ print ("Firome version" , __version__ ) # noqa: T201 # not for debug
36+ print ("Python version" , sys .version ) # noqa: T201 # not for debug
3337 sys .exit (0 )
3438
3539 LOGGER .info ("route: %s" , args .route )
@@ -38,7 +42,10 @@ def __no_prio_args():
3842 if args .debug :
3943 LOGGER .setLevel (logging .DEBUG )
4044
41- points = merge (args .route , args .recording , args .precision )
45+ route_points = interpolate (parse_gpx (args .route ), args .precision )
46+ activity_points = parse_fit (args .recording .resolve ())
47+
48+ points = merge (route_points , activity_points , args .precision )
4249
4350 if args .output == "tcx" :
4451 output_path = f"{ int (time .time ())} .tcx"
0 commit comments