Commit graph

173 commits

Author SHA1 Message Date
Miika Turkia
abcc4d55bd Including alarms and bookmarks on UDDF import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28 07:40:17 -08:00
Miika Turkia
57f85a773a UDDF export: save events occurring between samples
UDDF export saved events only if they occurred at exactly same time as a
profile sample. This patch will include events between samples as well.
This assumes that profile samples are recorded in even intervals.

Fixes #385

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-25 12:47:02 -08:00
Miika Turkia
dbd14f8662 Include O2 percentage in DivingLog import
Seems there is a different way to state O2 percentage in DivingLog.
This patch includes that format along with the previously seen one.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 08:52:38 -08:00
Miika Turkia
b07af31ea5 Try to detect whether DivingLog's samples are m/f
Seems that we can detect the unit of samples from DivingLog import when
comparing the maximum dive depth to the maximum recorded sample depth.
If sample is bigger, it is recorded in imperial. Of course this relies
on the assumption that the max depth of dive is recorded in metric unit,
but that seems to be the case, at least in the sample received.

It really does not make any sense to have both units in use for one dive
without any info on the unit used. But since that is the case, let's try
to cope with it.

Fixes #316

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 08:20:06 -08:00
Miika Turkia
03a01efdcb We need to use include statement on XSLT nowadays
After change to include XSLT files in resources, the import quit
working (even though the files and templates were found properly). This
patch uses include statement instead as it seems to work in our case.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 07:16:30 -08:00
Dirk Hohndel
b5d3476b0b Allow comma separated CSV files
The separator selector in the CSV import dialog was unused. This passes
the value into the xslt and adds ',' as possible value.

I'm sure this could be done much better (pass the actual character instead
of the index), but I couldn't get that to work and this does seem to do
the trick.

Also added a test dive to test this feature.

Fixes #321

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04 15:27:09 -08:00
Anton Lundin
7e36b4a253 Tidy up csv to xml xslt
Use if around the attribute, instead if a choose inside. Its less
horrible on the eyes.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-25 14:47:09 -08:00
Anton Lundin
5e04aaa756 Add the missed csv-field stopdepth
I managed to mess up and grab parts of my unfinished otu field code and
squash it into the wrong patch. Here is the code for stopdepth, and now
the code sets the in_deco flag to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-25 14:46:53 -08:00
Anton Lundin
26656310ab Add optional support for stopdepth import from csv
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:28 -08:00
Anton Lundin
5eccd73a30 Add optional support for cns import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:21 -08:00
Anton Lundin
8dde12fa35 Add optional support for po2 import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:16 -08:00
Anton Lundin
cf06f78892 Make temperature optional in csv import
This adds a checkbox to be able to import csv files without temperature.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:53:54 -08:00
Miika Turkia
cd0475fe96 Improve UDDF export to include more dive data
Basic information like buddy, location and visibility is included in
UDDF export. Also attempt to grab temperature information from both
temperature and divetemperature tags.

This partially fixes bug #224. However, at least divemaster and tags are
not exported (as the UDDF spec either does not have these or has hidden
the information of these fields somewhere between so many seemingly
unnecessary other fields).

See #224

Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:25:01 -08:00
Miika Turkia
5b0162d9d4 Improve UDDF import
Some improvements on importing different versions of UDDF logs. Also
include rating, gps coordinates and gas mixture in the import.

Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:24:20 -08:00
Miika Turkia
89770249d0 Add current date to CSV import
Since CSV import does not include date/time stamp, we need to generate
one for ourselves. This patch uses current time of the import as dive
time.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-20 15:27:07 +02:00
Miika Turkia
f771a94a85 Get information only from first line at each time
As some CSV log files seem to contain multiple sample lines for a single
time, we'll just grab the first one of them to avoid duplicates.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 12:19:23 -07:00
Miika Turkia
3ec6871720 Field variables for CSV import
Field variables for the CSV XSLT import have disappeared at some point
during developing GUI for the CSV import. So adding them to the XSLT for
the field selections to have effect.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 12:19:06 -07:00
Miika Turkia
80bced4f56 Rounding error on time change
When we convert time in seconds to mm:ss format, we do not want to round
but get floor instead.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16 11:52:05 -07:00
Benjamin
fb5ae28865 Correct spelling of "weight" throughout the code.
"Weight" was misspelled "weigth" in several places in the code
and comments.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:40:56 -07:00
Miika Turkia
ba5b5c3952 Initial code to import CSV log files
This patch implements basic functionality to import CSV formatted log
profiles to Subsurface. The import includes time, depth and temperature
from AP Logviewer based on one sample log file I have received. It is
assumed that dive time is the first parameter and depth second.

Temperature is given as a parameter from C source (hard coded currently
to field 15) but we should have a GUI implemented for selecting the
wanted fields.

The two different sample logs of CSV dive log export I have received use
tabulator as field separator. I assume the possible GUI should have
option for the FS as well to be given as parameter to the XSLT.

[Dirk Hohndel: small fix to the error string malloc]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-02 08:49:52 -07:00
Miika Turkia
9066c8bad6 Visibility scaling for UDDF import
Visibility is defined in meters in UDDF and we use scale up to 5 stars.
Thus the meters are scaled to our star rating using one-size-fits all
method.

< 1m => 1 star
<= 3m => 2 star
<= 5m => 3 star
<= 10m => 4 star
> 10m => 5 star

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-11 09:43:07 -04:00
Miika Turkia
1668952ed3 Include more information on Aquadivelog import
This adds information on cylinders and gas changes and some other basic
stuff like buddy, dive site, weights.

Visibility should probably be ignored as UDDF specifies it as meters and
we have a scale of 0-5. But currently it is copied as is to the
visibility field in Subsurface.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-08 21:02:46 -07:00
Miika Turkia
e504742dc8 Support for aquadivelog UDDF import
This implements limited support for importing dives from a Palm divelog
software called aquadivelog. Basic depth graph is imported but most of
the metadata is currently discarded.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:41:52 -07:00
Miika Turkia
e07072f10a Do not add unnecessary / at end of location on divelogs import
The check if both location and site exist was flawed causing an extra
slash on location name when the SITE was empty. Thus resulting in
multiple location candidates when exporting to divelogs.de and
re-importing to Subsurface.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17 06:50:50 -07:00
Miika Turkia
cfa36448a1 XSLT for importing individual DM4 dives
This XSLT can be used when exporting single dives from DM4 and importing
them to Subsurface.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:07:00 -07:00
Miika Turkia
68545465ba Switch to UTF-8 on .DLD export
Let's use the shiny new UTF-8 encoding on divelogs.de export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 06:25:36 -07:00
Miika Turkia
5533cd749f Fix end pressure on DLD export
While working on UDDF export I noticed that the grabbing of last
sample pressure was not working properly. This will fix it for DLD
export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:52:39 -07:00
Miika Turkia
ac5881c3fe Fix pressures on UDDF export
Examples on UDDF specification indicate that pressures are reported in
Pascal. Also prefer the sample data from first dive computer for start
and end tank pressures.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:52:30 -07:00
Miika Turkia
b18f9fa057 Gases and events support for UDDF export
This patch generates a gases section on UDDF export. The section
consists of all the unique gas mixes sawn on the dive log.

The latter part includes events to the export. Gas change and heading
events are properly translated to respective UDDF naming. Other events
are copied over as is. Some of the events are the same (ascent, deco,
rbt, surface) in UDDF some are not available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:51:19 -07:00
Miika Turkia
12d5ab4ce3 Export dives to UDDF file
This patch implements exporting dives from Subsurface to UDDF format.
Events and cylinder info are the most remarkable things still missing
from the export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-24 06:37:56 -07:00
Miika Turkia
6a98588ed0 Added support for UDDf version 3.1
This adds support for UDDF version 3.1 as produced by at least
DiversDiary. Basically we have to include the different name space into
our selections.

This patch also checks if the temperature is zero on all samples and
skips temperature readings if it looks like the dive computer does not
record them.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 13:49:21 -07:00
Miika Turkia
38d224a335 Only print separator when really needed on import
The separator was printed if SITE had data, even if LOCATION was empty.
Now print the separator only if both of these contain data.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-16 15:16:41 -07:00
Miika Turkia
757791335f Support divelogs.de exports that include Cyrillic characters
divelogs.de sends us XML files that explicitly state that they are in
ISO-8859-1 encoding (which is true). These files contain the HTML encoded
Cyrillic characters. Once we decode those characters the resulting file is
actually UTF-8 encoded (which is a superset of ISO-8859-1). That seriously
confuses libxml when it tries to parse things.

So instead recognize divelogs.de files and skip the encoding declaration
for them before decoding the HTML encoded non-ISO-8859-1 characters.

This does show, however, that divelogs.de incorrectly truncates the
encoded strings (at least in some sample data that I created the parsing
throws errors because of that).

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Based-on-code-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-15 16:29:37 -07:00
Miika Turkia
98d769a02f Correct ending pressure for .DLD export
We grab the pressure information from samples, if available. Otherwise,
we use information from first cylinder.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14 12:20:05 -07:00
Miika Turkia
03c21b0a92 Fix free form text fields on .DLD upload
We need to have CDATA around text fields to support e.g. Cyrillic
alphabet.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14 08:28:55 -07:00
Miika Turkia
f22527fdaf Fix XSLT when no weight system is given
Summing up weights ended only when there was one parameter left. With no
parameters we ended up in an infinite loop. Now we end also in case of
no parameters.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 13:43:02 -07:00
Miika Turkia
42ea5e3510 .DLD generation for uploading to divelogs.de
This generates a .DLD file of selected dives to be uploaded to
divelogs.de. The actual upload functionality along with sensible user
interface is still to be implemented. However, the resulting file from
this patch is tested to work (as far as I can tell) using upload API of
divelogs.de.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 09:29:12 -07:00
Miika Turkia
7c6ff9f957 Convert Subsurface XML to divelogs.de format
The resulting divelogs.de formatted XML is then to be zipped and
uploaded to divelogs.de website.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 09:27:53 -07:00
Miika Turkia
4297d931a3 Identify converted files as imported
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-08 10:17:33 -08:00
Miika Turkia
9f6b8ca89a Translate comma to colon on XML import
Translate decimal commas on XML import to decimal points. (As detected
from available sample files using Linus' debug printing.)

Also check for empty values on MacDive temperature import.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07 11:58:57 -08:00
Miika Turkia
a9cc7f9b10 Fix import when locale set to decimal comma
This should take care of locale caused problems when the input uses decimal
point but locale uses decimal comma. Also the sample I have of Suunto DM3
format weight is represented with comma instead of dot so converting that as
well.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07 10:27:20 -08:00
Miika Turkia
aa02798e2a Dive computer import improvements
Parse dive computer information or divelog generator information and
include it as divecomputerid and divecomputer as appropriate.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02 08:42:54 -08:00
Miika Turkia
0f9142b4e3 Grab a bit more info from UDDF import
otu and po2 are now grabbed. The po2 value comes from setpo2 tag. Also
divecomputerid is constructed from the generator information.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-01 23:49:09 -08:00
Miika Turkia
438299ff55 Parse ISO 8601 time format
This is an XSLT implementation of a function to parse the ISO 8601
datetime format used in uddf.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27 10:39:03 -08:00
Miika Turkia
38036a31d0 Handle one more date/time format for UDDF import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27 09:11:56 -08:00
Miika Turkia
cc96860165 MacDive import improvement
MacDive reports non-existent values as zero and in Imperial units it
would be 32F. This patch will try to make an educated guess whether we
have the proper temperature and pressure readings and ignore the zero
fields if it seems that there are no real samples from the dive
computer.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27 09:03:17 -08:00
Miika Turkia
ecdb4cd522 Fix MacDive import to convert Imperial temperature
MacDive import needs to convert temperatures to Celcius. However, it
seems that MacDive reports no reading as 32F (and probably 0C when using
Metric). There is no way of knowing whether we have no reading or
the temperature is actually zero, so we use the given temperature
currently as 0C is a valid temperature...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27 06:44:34 -08:00
Dirk Hohndel
881baafc26 DivingLog import: keep the dive computer name around
We simply set up the model attribute.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26 11:51:35 -08:00
Dirk Hohndel
5cea16ec50 Another update to DivingLog import
This fixes two bugs:
- we overwrote the max depth that we read from an XML file with 0 if there
  are no samples
- we didn't parse the DepthAvg tag in the DivingLog XML

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26 11:16:41 -08:00
Miika Turkia
686a27aee9 UDCF import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26 10:16:49 -08:00
Miika Turkia
826d27711e Test dives
On Tue, Feb 26, 2013 at 6:19 PM, Dirk Hohndel <dirk@hohndel.org> wrote:
> Miika Turkia <miika.turkia@gmail.com> writes:
>
>> On Tue, Feb 26, 2013 at 5:54 PM, Dirk Hohndel <dirk@hohndel.org> wrote:
>>> Miika Turkia <miika.turkia@gmail.com> writes:
>>>
>>>> On Tue, Feb 26, 2013 at 6:45 AM, Dirk Hohndel <dirk@hohndel.org> wrote:
>>>>> I added a few test dives exported from other software (Dm3, DiveLog 5.08,
>>>>> JDiveLog 10.2 from Mac - last one doesn't parse because of encoding... Also
>>>>> a composed XML zip file from DiveLog isn't supported, yet)
>>>>> Find them under dives
>>>>
>>>> Now this gets interesting. Is there ANY logic in the units in the
>>>> dives/TestDiveDiveLog5.08.xml? It seems that some of the temperatures
>>>> are in C (Airtemp and Watertemp) and some in F (samples). Otherwise I
>>>> would guess we are talking metric here, but I do not see any specs
>>>> (another log I have seen from DivingLog had all the units in metric,
>>>> as far as I could guess). BTW is the Weight in kg or lb?
>>>
>>> I have purchased DivingLog and should be able to create any combination
>>> of data for the test file that we could possibly want. I'll do a set in
>>> a moment that describe what SHOULD be there in their notes, maybe that
>>> will clear things up.
>>>
>>> That said, I really want to release 3.0.1 in the next couple of hours,
>>> so this may have to wait for 3.0.2 (if we end up needing that) or 3.1.
>>>
>>>> The divelogs.de UDCF format looks like it shouldn't take long to write
>>>> support for. I'll look into it this evening.
>>>
>>> It is evening for you, right? No pressure, just making sure I understand
>>> what may be coming in in patches in the next hour or two
>>
>> I currently have one version of the DivingLog XSLT. So a bit of
>> verification and that could possibly be used as is. However, this
>> could use a bit more testing than a new support to make sure things
>> are not going to be any worse than they currently are.
>>
>> I have not started with the UDCF yet, but that could be reasonably
>> fast to implement. However, no guarantees. (And yes, it is evening for
>> me)
>
> I can hold off 3.0.1 a couple hours longer if that is a realistic thing
> to do. I don't see the UDCF as that important since we have a different
> format from them that we support. So I think the best possible DivingLog
> support would be my preference.
>
> I'll add a few more exported dives from DivingLog next (and fix the
> naming of the existing ones).

In that case, here is the DivingLog XSLT if anyone can give it a test.

miika

From 4a62058f4f6fd4780f04bce6e1fe45e20abcf33f Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.turkia@gmail.com>
Date: Tue, 26 Feb 2013 17:46:53 +0200
Subject: [PATCH] XSLT for DivingLog

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26 08:50:05 -08:00
Miika Turkia
1f20d5feed XSLT for UDDF import
This XSLT imports the UDDF logs that I have received samples of. This
includes kenzooid and Heinrichs Weikamp's DR5.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-24 08:52:58 -08:00
Miika Turkia
48de523f15 JDiveLog import - add ndl=0 when on deco
This patch will add ndl='0:00 min' attribute on all the samples that
have stoptime or stopdepth set when importing from JDiveLog. This hack
ensures that dive computer's deco ceiling is shown.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-22 20:16:48 -08:00
Miika Turkia
ff1c33401b Divelogs.de import empty value fix
This checks that weight and dive durantion are defined before importing.
(Empty value concatenated with unit gives an error on import.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20 20:19:59 -08:00
Miika Turkia
9b4c251ebe Import divelogs.de
This XSLT converts divelogs.de logs into Subsurface format. Data that is
discarded: weather, water visibility, boat name.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20 10:57:24 -08:00
Miika Turkia
752ee66968 Improvements on MacDive import
New information of the upcoming MacDive log format is taken into account, more
Imperial conversions are added and a couple of bugs fixed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:49:31 -08:00
Miika Turkia
b85d5a36fc Support for Imperial units on MacDive log import
The cylinder size is treated as metric as the samples received indicate
it would be so.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-08 07:51:21 +11:00
Miika Turkia
b9a19813ea Import MacDive divelogs
This XSLT converts MacDive logs into Subsurface format. It supports both
the current version and the upcoming version of the log format.

Conversion was not tested with Imperial units as no samples were
available of such logs. Thus functionality with Imperial units is not
guaranteed.

Note that the gear inventory is currently discarded.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-07 07:06:49 +11:00
Miika Turkia
52f438bcd0 Treat headings properly when importing Suunto logs
This patch will convert a heading bookmark to Subsurface format.
Suunto's bookmark uses "Heading: <degrees>°" format and was previously
set as the full event name. Now the resulting event will look like:

<event name="heading" value="333" time="0:58 min"/>

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 21:51:42 -08:00
Miika Turkia
f6bd9d1a14 Convert deco info from JDiveLog to Subsurface
This patch correctly converts the available deco data from JDiveLog files.
In order for this to work correctly the next patch from Linus is needed as
well.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-19 20:04:22 -10:00
Miika Turkia
7259cf5bb6 Count the actual decimal digits for import
Apply the decimal time conversion hack for JDiveLog import if there are
less than 2 digits in the decimal part (and value is less than 60).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-28 20:49:44 -07:00
Miika Turkia
2ee26caba4 JDiveLog import fallback for 1 digit numbers
Use the decimal time format fallback also for one digit numbers as
Linus suggested. Thus 1.1 min would result in 1 min 6 sec.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 21:46:04 -07:00
Miika Turkia
e544ca5f6a Handle seconds in decimal notation (from JDiveLog)
This is a hack to convert time stored in decimal notation to proper
seconds. When using metric units the default way of JDiveLog to store
seconds is to have the amount of seconds after decimal point (1.20 is 1
minute 20 seconds). In some odd case it is reportedly possible that the
seconds are actually 100 based, thus we need to convert that to seconds
(1.33333 will become 1 minute 20 seconds).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 11:14:58 -08:00
Miika Turkia
27f7e58493 Improvements on JDiveLog import
If dive computer does not record the sample interval, but records time
stamps on the samples, we use those.

A couple of corner cases fixed that were noticed in new log samples.
Also fixes when importing dives logged in imperial units.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-24 09:00:56 -08:00
Miika Turkia
25ddf1caee Map JDiveLog alarms to Subsurface events
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-21 20:46:50 -07:00
Miika Turkia
413065dcdc Add weight and suit support for JDiveLog import
Use the suit and weightsystem support of Subsurface when importing
divelogs from JDiveLog. (They were previously included in the notes
field as support for these fields was missing from Subsurface.)

After import the weightsystem is undefined and weight unit is the
default of Subsurface. Unfortunately the weight field in JDiveLog is
text field and might contain pounds and kilograms mixed in seemingly
random order. Thus 2 pounds of weight might be transformed to 2 kg.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 09:53:32 -07:00
Linus Torvalds
b2e4ca552f Suunto SDE conversion: add boat name to notes if it exists
This is, I think, the last piece of relevant information that I can find
in Szymon's SDE file.

Which is not to mean that we get all the conversions right, or that we
handle the more complex cases (still no multi-cylinder import, for
example). But it should be much better than it used to be.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12 12:28:40 -07:00
Linus Torvalds
36e4abf8c0 Suunto SDE updates, take 178: add weight and visibility info
This converts the weight information into subsurface weights, and also
adds visibility info (if it exists) into the notes for the dive.

More fall-out from me looking at the nasty suunto xml files, now that I
have a few that actually have some info that isn't just from the
computer download.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12 12:21:32 -07:00
Linus Torvalds
8a58dae3ae Fix more Suunto SDM xml conversion problems
Looking at the XML of the two dives Szymon Kosecki sent out to the
subsurface list, I notice that our cylinder size conversion was wrong.
It looks like CYLINDERUNITS is what determines whether the cylinder size
is in metric (0) or imperial (1) units.

Of course, if you gave a cylinder size in cuft and didn't give a working
pressure, subsurface will just ignore the size as the random crap it is.
We *could* default to a working pressure of 3000 psi, of course.

This also picks up the CYLINDERDESCRIPTION value, although neither of
Szymon's dives actually had any description.

I need more SDE xml files to figure out how multi-cylinder dives look
etc, but I think this gets most *simple* SDE files converted almost
correctly now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12 12:01:38 -07:00
Linus Torvalds
12f2c2ed5c Fix dive notes import from Suundo SDM
The xslt translation didn't add the <notes> tag for the notes, so while
it did select the notes from the SDM file, that never made it into the
subsurface notes.

Also added weather info to the notes, mainly as an example.

There are probably other things we could do, but this fixes at least the
trivial test-case from Szymon Kosecki.

Reported-by: Szymon Kosecki <skosecki@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-11 14:21:19 -07:00
Miika Turkia
d1d17c543c Multiple cylinder support for JDiveLog import
Support for multiple cylinders and gas change events when Importing
JDiveLog logs to Subsurface. This is tested with manually crafted data
and not real data (originating from dive computer).

NOTE: Subsurface does not handle importing multiple cylinders
correctly but imports only the first cylinder. However, manually
converting data to a file and opening that in Subsurface works
correctly.
 (xsltproc jdivelog2subsurface.xslt jdivelog-gas.jlb > gas.xml)

Some minor tweaking on importing JDiveLog specific fields to notes
fields in Subsurface is also included.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-18 11:56:26 -08:00
Miika Turkia
61f3114fce XSLT to import SDM dive log
This is tested with Linus' sample data, all basic functionality seems to
be working properly. Gas changes are implemented but not tested as there
was no samples of those. Multiple cylinders are missing because there
was no samples available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-21 11:33:52 -08:00
Miika Turkia
84e6f200f6 XSLT to transform JDiveLog to Subsurface format
XSLT file to transfer dive logs from JDiveLog format to Subsurface
format. It can be used on command line with the following syntax:
	xsltproc <divelog.jlb> > <divelog.xml>

Basic functionality such as depth readings and dive information is
currently supported. However, this is only tested in metric units.

What is currently missing is at least tank changes and tank pressure (as
no sample data was available).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-30 11:35:23 -07:00