Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TCX files #8

Closed
martin-ueding opened this issue Nov 21, 2023 · 2 comments
Closed

Support TCX files #8

martin-ueding opened this issue Nov 21, 2023 · 2 comments
Labels
type: enhancement New feature or request
Milestone

Comments

@martin-ueding
Copy link
Owner

A user asked for TCX files, which are not supported yet. I'll have to look into this file format.

@martin-ueding martin-ueding added the type: enhancement New feature or request label Nov 21, 2023
@martin-ueding martin-ueding added this to the Next milestone Nov 26, 2023
@martin-ueding
Copy link
Owner Author

I've added https://github.com/alenrajsp/tcxreader, but there is some more work to do. Somehow the files start with spaces:

          <?xml version="1.0" encoding="UTF-8"?>
<TrainingCenterDatabase
  xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd"
  xmlns:ns5="http://www.garmin.com/xmlschemas/ActivityGoals/v1"
  xmlns:ns3="http://www.garmin.com/xmlschemas/ActivityExtension/v2"
  xmlns:ns2="http://www.garmin.com/xmlschemas/UserProfile/v2"
  xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.garmin.com/xmlschemas/ProfileExtension/v1">
            <Activities>
              <Activity Sport="Other">

And that confuses the parser:

2023-11-26 17:53:26 geo_activity_playground.importers.directory ERROR Error while parsing file Activities/9890487249.tcx:
Traceback (most recent call last):
  File "/home/mu/Projekte/geo-activity-playground/geo_activity_playground/core/activity_parsers.py", line 133, in read_activity
    df = read_tcx_activity(path, opener)
  File "/home/mu/Projekte/geo-activity-playground/geo_activity_playground/core/activity_parsers.py", line 96, in read_tcx_activity
    data = tcx_reader.read(path)
  File "/home/mu/.cache/pypoetry/virtualenvs/geo-activity-playground-cM-Vn1fX-py3.9/lib/python3.9/site-packages/tcxreader/tcxreader.py", line 26, in read
    tree = ET.parse(fileLocation)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 1222, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 1, column 10

@martin-ueding
Copy link
Owner Author

Seems to work now.

martin-ueding added a commit that referenced this issue Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant