Import Vcf Contacts

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(another update)
(Modification to the script)
Line 7: Line 7:
 
== Modification to the script ==
 
== Modification to the script ==
  
Al Johnson posted an extension to this script to handle vcf files wihl multiple contacts. It should work as before if there's just one contact per file. Here's the modified bit:
+
Al Johnson posted an extension to this script to handle vcf files with multiple contacts. There should not be blank lines between the vCards in the file. It should work as before if there's just one contact per file. Here's the modified bit:
  
 
  for name in names:
 
  for name in names:

Revision as of 14:30, 12 July 2008

Neo FreeRunner uses Evolution data server (eds) for addressbook. However, the specific version used differs from what is probably used on your desktop (if you have Evolution installed), so you cannot just copy addressbook.db from your computer to Neo (bug 1119).

If you want to import your old Contacts to your Neo you could use this simple script:

Simple vcf import script (could the script be licensed under BSD or GPL?)

Contents

Modification to the script

Al Johnson posted an extension to this script to handle vcf files with multiple contacts. There should not be blank lines between the vCards in the file. It should work as before if there's just one contact per file. Here's the modified bit:

for name in names:
  print name
  vcard = ""
  f=open(name,'r')
  for line in f:
   vcard = vcard + line
   if line[:9] == "END:VCARD":
     getAddressBook().addContact(vcard)
     vcard = ""

Exporting old contacts to VCard format

Next step is to export your old contacts as vcf. I know its possible with Nokia phones and i used a Winmobile->activesync->Outlook export plugin to get my Contacts from my old Cell. In LG phones the backup function to memory card creates one file with multiple VCards. Etc.

Usage

The script is for the 2007.2 Version (default install on Neo FreeRunner), not for Qtopia

You need Python to use this script so do a

opkg install python-dbus

to install python and the python dbus module

The script does a listdir and imports ALL files it found in that dir. (i'm a bad python programmer)

  1. Copy all vcf files to a separate directory on my freerunner
  2. Copy the ac script to the parent directory also on my freerunner
  3. Have the contacts program running (so you have eds running too)
  4. Go to the terminal on the freerunner and type in the vcf directory: "python ../ac" (root@om-gta02:~/vcf# python ../ac)
    1. Note: You must call the script in the OM terminal not via Bluetooth or USB or you get a dbus error.
  5. Done :D

Troubleshooting

  • Make sure you have python and python-dbus installed
  • Make sure you have no illegal chars (utf) in the filename and inside the vcf files. (I had problems with Ü,Ä etc)
    • The characters seem to work if you convert them from =C3=A4 type of format to proper UTF-8, and the vcards also specify UTF-8 charset. you cannot use other charsets besides UTF-8 since they are delivered via DBus which does not allow others.
  • Only vcf files should be in your current directory so do a ../ac.
  • You must call the script in the OM terminal not via Bluetooth or USB. If you do so a dbus error occur


Thanks to Import_Sim_Contacts for the original Python Script.

Personal tools

Neo FreeRunner uses Evolution data server (eds) for addressbook. However, the specific version used differs from what is probably used on your desktop (if you have Evolution installed), so you cannot just copy addressbook.db from your computer to Neo (bug 1119).

If you want to import your old Contacts to your Neo you could use this simple script:

Simple vcf import script (could the script be licensed under BSD or GPL?)

Modification to the script

Al Johnson posted an extension to this script to handle vcf files with multiple contacts. There should not be blank lines between the vCards in the file. It should work as before if there's just one contact per file. Here's the modified bit:

for name in names:
  print name
  vcard = ""
  f=open(name,'r')
  for line in f:
   vcard = vcard + line
   if line[:9] == "END:VCARD":
     getAddressBook().addContact(vcard)
     vcard = ""

Exporting old contacts to VCard format

Next step is to export your old contacts as vcf. I know its possible with Nokia phones and i used a Winmobile->activesync->Outlook export plugin to get my Contacts from my old Cell. In LG phones the backup function to memory card creates one file with multiple VCards. Etc.

Usage

The script is for the 2007.2 Version (default install on Neo FreeRunner), not for Qtopia

You need Python to use this script so do a

opkg install python-dbus

to install python and the python dbus module

The script does a listdir and imports ALL files it found in that dir. (i'm a bad python programmer)

  1. Copy all vcf files to a separate directory on my freerunner
  2. Copy the ac script to the parent directory also on my freerunner
  3. Have the contacts program running (so you have eds running too)
  4. Go to the terminal on the freerunner and type in the vcf directory: "python ../ac" (root@om-gta02:~/vcf# python ../ac)
    1. Note: You must call the script in the OM terminal not via Bluetooth or USB or you get a dbus error.
  5. Done :D

Troubleshooting

  • Make sure you have python and python-dbus installed
  • Make sure you have no illegal chars (utf) in the filename and inside the vcf files. (I had problems with Ü,Ä etc)
    • The characters seem to work if you convert them from =C3=A4 type of format to proper UTF-8, and the vcards also specify UTF-8 charset. you cannot use other charsets besides UTF-8 since they are delivered via DBus which does not allow others.
  • Only vcf files should be in your current directory so do a ../ac.
  • You must call the script in the OM terminal not via Bluetooth or USB. If you do so a dbus error occur


Thanks to Import_Sim_Contacts for the original Python Script.