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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>