maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Extract contacts from backup files (https://talk.maemo.org/showthread.php?t=59384)

flair 2010-07-29 09:47

Extract contacts from backup files
 
Hi there!
my N900 got stolen a week ago and now i only got a backup from which i hope i can extract my contacts to another mobile phone.
is there a way to get them in a .csv or somehow, that i can import them to my old mobile?
thanks a million

gLobster 2010-07-29 09:58

Re: Extract contacts from backup files
 
Which backup? By build backup programm or made by PC Suite ?

flair 2010-07-29 10:32

Re: Extract contacts from backup files
 
thanks for the reply! i most probably made it with OVI Suite (or directly with the backup software on the phone, not sure). its structured like this:
N900(folder)
>Backup01(folder)
>>applications.zip
>>backup.metadata
>>bookmarks.zip
>>comm_and_cal.zip
>>settings.zip

there is a file comm_and_cal.zip\Root\home\user\.osso-abook-backup\db\addressbook.db which includes all the information (i guess), but i dont know how to export/format them in a way that i can import them elsewhere

hope this helps, thank you so much!

gLobster 2010-07-29 10:39

Re: Extract contacts from backup files
 
I think adressbook.db is sqlite database. Try to connect to the file by sqlite. It's very simple program.

flair 2010-07-29 11:19

Re: Extract contacts from backup files
 
thanks for the hint, i am not familiar with sqlite, but i think i figured out how to use it.
1. i put the sqlite3.exe in the same folder as the addressbook.db
2. then i ran "sqlite3.exe addressbook.db" from cmd
3. i typed "select *;" --> error: no tables specified;
4. i typed "create table test;" --> error: file is encrypted or is not a database
5. i typed "select * from sqlite_master;" --> error: file is encrypted or is not a database

does this tell you anything? should i try sth else?
when i open the address.db with an editor it starts with some command characters followed by what i guess is my addressbook, where each entry looks something like this:
VERSION:3.0
REV:2010-04-28T11:21:36Z
UID:259
PHOTO;VALUE=uri:file:///home/user/.osso-abook/photos/2H4YBV
FN:***** ***
EMAIL:******@******.com
X-SKYPE;X-OSSO-VALID=yes;TYPE=skype:******
URL:http://www.facebook.com/******
TEL;TYPE=VOICE:******
TEL;TYPE=CELL:******
TEL:******
BDAY:2010-******
NICKNAME:******
N:******;******
END:VCARD

nicolai 2010-07-29 11:31

Re: Extract contacts from backup files
 
As far as I know, it isn't a sqlitedb file, but Berkeley-DB.

regards
Nicolai

flair 2010-07-29 11:52

Re: Extract contacts from backup files
 
so there isnt a possibility to export the contacts using the OVI Suite or PC Suite? that really sucks..
if it is berkeley DB, how can i extract the information to a format suitable for android phones? i only found the berkely source on the oracle website, dont know how to deal with that..
those contacts are really important for me, it would be a pain in the *** to have to copy them manually... please help!!

manvik60 2010-07-29 15:17

Re: Extract contacts from backup files
 
As nicolai already told, its in Berkeley-DB format. So you need some utility like db4.5_dump to dump the addressbook.db into more readable format.

I have cygwin installed on my XP and that includes db4.5_dump.exe in it. If you dont have cygwin, install it from here. At the page, right hand it says install. When you install make sure you install the db4.5 package also. Or you can install it in any other os you want,like ubuntu etc.

After install steps.
-- copy the addressbook.db to your PC.
-- open the cygwin prompt
-- cd to directory where the addressbook.db is and run below command,
PHP Code:

db4.5_dump.exe -p addressbook.db sed -'9,$ !d' \
-
'/^ pas-id/d' \
-
's/\\0d\\0a/\n/g' \
-
's/\\\\, / /g' \
-
's/^ //' -'s/\\00//' \
-
's/\\c3\\89/É/g' \
-
's/\\c3\\8a/È/g' \
-
's/\\c3\\a9/é/g' \
-
's/\\c3\\a8/è/g' \
-
's/\\c3\\aa/ê/g' \
-
's/\\c3\\a0/à/g' \
-
's/\\c3\\a1/á/g' \
-
's/\\c3\\a2/â/g' \
-
's/\\c3\\a7/ç/g' \
-
's/\\c3\\b4/ô/g' \
-
's/\\c3\\af/ï/g' \
-
's/\\c3\\ab/ë/g' \
mycontact.vcf 

Now this will convert your addressbook.db into a nice readable vcf format. Now you can use some tool to convert into excel or someother format (whatever you want)

This is not my code, but I have used it sometime back, so maybe some syntax error could be there. But you got the idea how to do it.

flair 2010-07-29 17:33

Re: Extract contacts from backup files
 
hey manvik,

thank you so much, despite some errors i was able to convert my contacts by using your code! i had to reconvert it to csv afterwards (didnt know how to do it directly) and somewhere along the process my germen ä, ö, ü got lost, but it wont be too much work to correct that.

again thank you so much for the fast and great support!

manvik60 2010-07-29 17:44

Re: Extract contacts from backup files
 
Hi flair,

Glad it worked for you. But I just noticed that, the code is missing the backslash at the end. But when I edit it, I see the "\" properly, so may be when you write PHP code in forum, it dosen't display "\" :-(

Any ways the code with \ is below.

db4.5_dump.exe -p addressbook.db | sed -e '9,$ !d' \
-e '/^ pas-id/d' \
-e 's/\\0d\\0a/\n/g' \
-e 's/\\\\, / /g' \
-e 's/^ //' -e 's/\\00//' \
-e 's/\\c3\\89/É/g' \
-e 's/\\c3\\8a/È/g' \
-e 's/\\c3\\a9/é/g' \
-e 's/\\c3\\a8/è/g' \
-e 's/\\c3\\aa/ê/g' \
-e 's/\\c3\\a0/à/g' \
-e 's/\\c3\\a1/á/g' \
-e 's/\\c3\\a2/â/g' \
-e 's/\\c3\\a7/ç/g' \
-e 's/\\c3\\b4/ô/g' \
-e 's/\\c3\\af/ï/g' \
-e 's/\\c3\\ab/ë/g' \
> mycontact.vcf


All times are GMT. The time now is 19:25.

vBulletin® Version 3.8.8