From c87d7d96b5a3a00fcd21a792a29500ffd5479567 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sun, 12 Jul 2015 23:16:50 +0530 Subject: Divinglog import: import a bit more data from DB Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/parse-xml.c b/parse-xml.c index 62eceaa83..9d6cb3adc 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -2869,14 +2869,40 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column) if (data[6]) cur_dive->dc.duration.seconds = atoi(data[6]) * 60; + if (data[7]) + utf8_string(data[7], &cur_dive->divemaster); + + if (data[8]) + cur_dive->airtemp.mkelvin = C_to_mkelvin(atol(data[8])); + + if (data[9]) + cur_dive->watertemp.mkelvin = C_to_mkelvin(atol(data[9])); + + if (data[10]) { + cur_dive->weightsystem[0].weight.grams = atol(data[10]) * 1000; + cur_dive->weightsystem[0].description = strdup(translate("gettextFromC", "unknown")); + } + + if (data[11]) + cur_dive->suit = strdup(data[11]); + settings_start(); dc_settings_start(); - cur_settings.dc.model = strdup("Divinglog import"); + + if (data[12]) { + cur_dive->dc.model = strdup(data[12]); + } else { + cur_settings.dc.model = strdup("Divinglog import"); + } dc_settings_end(); settings_end(); - cur_dive->dc.model = strdup("Divinglog import"); + if (data[12]) { + cur_dive->dc.model = strdup(data[12]); + } else { + cur_dive->dc.model = strdup("Divinglog import"); + } dive_end(); return SQLITE_OK; @@ -2890,7 +2916,7 @@ int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buffer, char *err = NULL; target_table = table; - char get_dives[] = "select Number,strftime('%s',Divedate || ' ' || ifnull(Entrytime,'00:00')),Country || ' - ' || City || ' - ' || Place,Buddy,Comments,Depth,Divetime from Logbook where UUID not in (select UUID from DeletedRecords)"; + char get_dives[] = "select Number,strftime('%s',Divedate || ' ' || ifnull(Entrytime,'00:00')),Country || ' - ' || City || ' - ' || Place,Buddy,Comments,Depth,Divetime,Divemaster,Airtemp,Watertemp,Weight,Divesuit,Computer from Logbook where UUID not in (select UUID from DeletedRecords)"; retval = sqlite3_exec(handle, get_dives, &divinglog_dive, handle, &err); -- cgit v1.2.3-70-g09d2