dcmd2json
—
export dives to JSON
dcmd2json |
[ -av ]
[files... ] |
The
dcmd2json
utility accepts XML files
generated by
dcmd(1) and exports dive profiles to
JSON. Its arguments are as follows:
-
-
-a
- Show sample times relative to the first dive's start time. This is useful
for free-diving where multiple dives are done in sequence.
-
-
-v
- Parse files in verbose mode.
-
-
- files...
- XML input files with one or more dives.
The output of
dcmd2json
has the following
structure:
{"divecmd2json":
{"version": "0.0.1",
"divers": [
Each instance has a root of
divecmd2json
, followed by
the version number. An array of all divers comes next.
{"ident": "kristaps",
"dives": [
{"num": 41,
"datetime": 1483178882,
"samples": [
For each diver (this is an empty string if there's no given diver), an array of
all dives. Dives consist of a
num
, the dive number as
exported from
dcmd(1), and the optional date-time
stamp (UNIX epoch). Dives are sorted in order of increasing
datetime
. If the
datetime
is
not provided, they come last. What follows that are the samples.
{"time": 0, "depth": 1.28, "temp": 16},
{"time": 20, "depth": 2.32, "temp": 16},
{"time": 40, "depth": 1.35, "temp": 16},
]
}]
}]
}
}
Samples always consist of a
time
, in seconds from the
start of the dive, and optionally contain a
depth
(in
metres) and
temp
(in celsius).
The
dcmd2json
utility exits 0 on
success, and >0 if an error occurs.
The
dcmd2json
utility was written by
Kristaps Dzonsons,
kristaps@bsd.lv.