feat: add csv export support

This commit is contained in:
HugoPoi 2021-02-20 00:05:19 +01:00
parent 124eb02e97
commit 407544412f
2 changed files with 14 additions and 1 deletions

View File

@ -2,6 +2,12 @@
A cli tool to export GoPro metadatas from video files.
## Install
`npm install -g gopro-telemetry-exporter`
or just prefix command `npx`
## Usage
`gopro-telemetry-exporter --input GPX010001.MP4 --output GPX010001.gpx --GPS5Fix 3 --preset gpx --groupTimes 200`
@ -13,6 +19,10 @@ geojson, csv, mgjson, virb, and other format that can be supported by
* All other options will be pass directly to [GoPro Telemetry](https://www.npmjs.com/package/gopro-telemetry), you
can check the list
### Example CSV export of GPS5 stream
`gopro-telemetry-exporter --input GPX010001.MP4 --output test.csv --GPS5Fix 3 --preset csv --groupTimes 200 --stream GPS5`
## TODO
* Check all the presets

View File

@ -29,9 +29,12 @@ async function main(options) {
}
goproTelemetry(res, _.omit(options, ['_', 'input', 'output']), telemetryData => {
if (!_.isString(telemetryData)) {
if (options.preset === 'csv') {
telemetryData = _.values(telemetryData)[0];
} else if (!_.isString(telemetryData)) {
telemetryData = JSON.stringify(telemetryData);
}
fs.writeFileSync(options.output, telemetryData);
});