summaryrefslogtreecommitdiffstats
path: root/xslt
AgeCommit message (Collapse)Author
2013-10-20Add current date to CSV importGravatar Miika Turkia
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-17Get information only from first line at each timeGravatar Miika Turkia
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-17Field variables for CSV importGravatar Miika Turkia
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-16Rounding error on time changeGravatar Miika Turkia
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-04Correct spelling of "weight" throughout the code.Gravatar Benjamin
"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-02Initial code to import CSV log filesGravatar Miika Turkia
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-06-11Visibility scaling for UDDF importGravatar Miika Turkia
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-08Include more information on Aquadivelog importGravatar Miika Turkia
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-07Support for aquadivelog UDDF importGravatar Miika Turkia
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-05-17Do not add unnecessary / at end of location on divelogs importGravatar Miika Turkia
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-04-22XSLT for importing individual DM4 divesGravatar Miika Turkia
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-09Switch to UTF-8 on .DLD exportGravatar Miika Turkia
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-03-26Fix end pressure on DLD exportGravatar Miika Turkia
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-26Fix pressures on UDDF exportGravatar Miika Turkia
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-26Gases and events support for UDDF exportGravatar Miika Turkia
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-24Export dives to UDDF fileGravatar Miika Turkia
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-19Added support for UDDf version 3.1Gravatar Miika Turkia
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-16Only print separator when really needed on importGravatar Miika Turkia
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-15Support divelogs.de exports that include Cyrillic charactersGravatar Miika Turkia
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-14Correct ending pressure for .DLD exportGravatar Miika Turkia
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-14Fix free form text fields on .DLD uploadGravatar Miika Turkia
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-10Fix XSLT when no weight system is givenGravatar Miika Turkia
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.DLD generation for uploading to divelogs.deGravatar Miika Turkia
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-10Convert Subsurface XML to divelogs.de formatGravatar Miika Turkia
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-08Identify converted files as importedGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-07Translate comma to colon on XML importGravatar Miika Turkia
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-07Fix import when locale set to decimal commaGravatar Miika Turkia
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-02Dive computer import improvementsGravatar Miika Turkia
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-01Grab a bit more info from UDDF importGravatar Miika Turkia
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-02-27Parse ISO 8601 time formatGravatar Miika Turkia
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-27Handle one more date/time format for UDDF importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-27MacDive import improvementGravatar Miika Turkia
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-27Fix MacDive import to convert Imperial temperatureGravatar Miika Turkia
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-26DivingLog import: keep the dive computer name aroundGravatar Dirk Hohndel
We simply set up the model attribute. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26Another update to DivingLog importGravatar Dirk Hohndel
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-26UDCF importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-26Test divesGravatar Miika Turkia
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-24XSLT for UDDF importGravatar Miika Turkia
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-22JDiveLog import - add ndl=0 when on decoGravatar Miika Turkia
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-20Divelogs.de import empty value fixGravatar Miika Turkia
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-20Import divelogs.deGravatar Miika Turkia
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-09Improvements on MacDive importGravatar Miika Turkia
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-08Support for Imperial units on MacDive log importGravatar Miika Turkia
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-07Import MacDive divelogsGravatar Miika Turkia
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-01-01Treat headings properly when importing Suunto logsGravatar Miika Turkia
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>
2012-12-19Convert deco info from JDiveLog to SubsurfaceGravatar Miika Turkia
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-11-28Count the actual decimal digits for importGravatar Miika Turkia
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-26JDiveLog import fallback for 1 digit numbersGravatar Miika Turkia
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-26Handle seconds in decimal notation (from JDiveLog)Gravatar Miika Turkia
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-24Improvements on JDiveLog importGravatar Miika Turkia
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>