python-fitparse
python-fitparse copied to clipboard
Add FitFileEncoder for writing FIT files
Fix #8
I have started with FitFileEncoder
, see the test_encoder.py
. I will rebase this PR while fixing the FitFileEncoder
and edit this initial message.
The messages are created by DataMessageCreator
just to keep quite a lot of code outside of the core DataMessage
.
Cannot write:
- compound fields,
- accumulated fields,
- developer fields.
But these fields are not necessary for an application generated FIT files. The compound and accumulated fields are designed to save a few bits of the resulting FIT file, which is not necessary for a server generated files and, furthermore, I need to use simple FIT features only to make some weak FIT parsers also working.
@dtcooper @pR0Ps Please review the code. I would appreciate to move some code changes out of this PR and merge it to master to make this PR smaller and simpler to review:
-
fileish_open
, see #54 - RFTC Crc, see the commit "RFCT move crc computation to records.Crc, add test". Also speeds up the
FitFile
when CRC is ignored. - Move
apply_scale_offset
to therecords.py
, what about to merge it to thefield.render
code? - Solve the optimisations #57
- Rename
FitFileDataProcessor.process_xxx
methods toparse_xxx
- Add
BaseTyp.invalid_value
, so as theparse
does not need to be defined in most of times.
Thank you
@pR0Ps I've addressed most of the comments by amend. See the rest. Do not want to merge it into the master until #57 is resolved.
+1 writing fit files will be useful ! Please see my PR on @xmedeko fork which includes some scripts to fix FIT files or combine them into multi-sport ativities: [pull request on xmedeko fork] (https://github.com/xmedeko/python-fitparse/pull/1) Unfortunately there are conflicts with upstream.... I've not changed anything yet as I can see some different opinions in this stream...
+1 would love to see this merged as well!
+1, would love to have this merged in master. Will have to clone this manually to get access to this new feature for now ! Thanks for this !!
I am sorry but I do not plan to maintain this PR and resolve conflicts due to the development in the master. Personally, I have decided do abandon FIT writing (and parsing, too) in pure Python since the FIT format is loosely specified and complex. I recommend to make some FIT<-->JSON tool from the original FIT SDK (e.g. C#, Java, C++) and just call this tool from Python.