Sailfish Contacts Rescue

Rating: 
5
Your rating: None Average: 5 (1 vote)

After upgrading from SFOS 3.2 to 4.1 I missed to backup my contacts so I had to find a way to restore them from the SQLite DB to use them again.

Problematic is, that the schema had changed. So I diceded to create a script converting DB entries to vCards.

Now a working Version including Avatars (vCard Pictures included in vCards).

Documentation and Project wiki could be found here-, Sailfish Contacts Restore Wiki.

Script could by found here: Download Python Script in latest version

 

$ ./ContactRestore.py --help
usage: ContactRestore.py [-h] --db DB --output OUTPUT [--avatars AVATARS] [--debug] [--version]

Restore SailfishOS 3 Contacts

optional arguments:
  -h, --help            show this help message and exit
  --db DB, -d DB        Sqlite3 Database file usually
                        /home/{nemo,defaultuser}/.local/share/system/Contacts/qtcontacts-
                        sqlite/contacts.db
  --output OUTPUT, -o OUTPUT
                        Output directory for vcf files
  --avatars AVATARS, -a AVATARS
                        Avatar directory. If present otherwise we skip this block of avatars, means, no
                        avatars at all
  --debug               debugging output to identify problems
  --version             show program's version number and exit

This script was written to restore SailfishOS 3 contacts as VCF files. To see additional information,
visit: https://wiki.siningsoft.de/doku.php?id=sailfishos:projects:sailfish_contacts_rescue

$ ./ContactRestore.py -d Testdata/contacts_with-Phone-Mobile-Fax-Pager-Assistent-Addresses.db -o Testdata/Output/
exporting SiSo Emulator to file Testdata/Output//SiSo_Emulator.vcf
exporting TestUserFirstName TestUserLastName to file Testdata/Output//TestUserFirstName_TestUserLastName.vcf
exporting 2nd Test *FN* User *LN* to file Testdata/Output//2nd_Test_*FN*_User_*LN*.vcf
exporting Phone Test to file Testdata/Output//Phone_Test.vcf
exporting Ludowig Adressuser to file Testdata/Output//Ludowig_Adressuser.vcf

 

 

Comments

devnull's picture

source is accessable again. Sorry for the slow connection. This will.change in future, once the connection was upgraded.

aviarus's picture

unfortunately is the script not accessible at the moment

DLQ's picture

There is another PhoneType: 4 
I don't know what it stands for, but after defaulting it to 'voice' the script worked well for me. Thanks!

Firefox84's picture

The problem isn't the Android-side of the procedure, the export was done using backup & Restore, the format: xml version='1.0' encoding='UTF-8' standalone='yes'
xml-stylesheet type="text/xsl" href="sms.xsl. But if you try to open the message dump of SFOS, the only tool that works for me is libre office, but the output is not really usable. You see the messages, but the arrangement of the data is not helpful, its seams like a big chaos. I don't want to create a huge project for you, i just thought you might be interested in finding a solution for it :) Thanks anyway!

devnull's picture

Hi, yes I'm Always interested
. At least creating sample data to analyze to have something to start. Please contact me at sailfish@siningsoft.de

Firefox84's picture

Hi @devnull, there is the possibilty to import vcd files coming from Android, the transfer of the text messages is only possible from SFOS to SFOS. In Android i am able to export an xml file with all my text messages, but in SFOS i am neither able to edit the messages DB, nor to convert my xml file to a DB file. There was one guy who wrote a script, but it seems way to complicated for the average SFOS user like me :) https://github.com/javaes/sailfish-msg-importer

I just thought maybe someone is interested i writing such an app, that would facilitate the switch for Android users to SFOS. Thanks anyway for your reply :)

devnull's picture

When you export in Android, which tool have you used for that ? Allthough I think it would be possible to do that, I'm not sure when I find time for that. Anyway, one needs at least some example data with all cases in it (message threads, single messages, send and received messsges) and then one would need a way to understand the schema in that XML file. Maybe you could prepare something like that ?

devnull's picture

Hi Firefox84, could be interesting, but is a complete different source of problem. I can imagine a android and SFOS application to use for migration. On both sides its kind of API to read and write contacts, messages, all that stuff. But isn't there already a integrated migration wizard in SFOS?

Firefox84's picture

Wow nice, if we are at the topic rescuing. How about a tool to be able to transfer Android sms to Sailfish os, there is a script but its way to complicated. What would be nice would be a kind of Backup & restore vrrsion for SFOS. I am just mentioning this, because of tge DB for the messages, so maybe this would also be trivial for you :) Thanks for your work!