Re: Import Contacts

Previous thread: Found it.(GSM antenna port) by Scott Derrick on Wednesday, July 9, 2008 - 8:03 am. (4 messages)

Next thread: Better keyboard? by Arne Zachlod on Wednesday, July 9, 2008 - 9:27 am. (25 messages)
From: smurfy - phil
Date: Wednesday, July 9, 2008 - 8:26 am

Hey,

i added a small script and infos at:

http://wiki.openmoko.org/wiki/Import_Vcf_Contacts

how to import vcf contacts to the default 2007.2 contacts application

Phil

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Al Johnson
Date: Wednesday, July 9, 2008 - 8:44 am

Does this work for files containing more than one contact, or just for one 
contact per file?


_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Al Johnson
Date: Wednesday, July 9, 2008 - 3:52 pm

Thanks Phil. I tweaked it to get it to work with more than one contact per 
file as exported by my K700i. 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 = ""

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Brian C
Date: Friday, July 11, 2008 - 9:18 am

I'm using Al's modification to Phil's import script and get the
following error.  Anyone understand and can explain how to fix?

root@om-gta02:/media/card/Contacts/abook# python ../import
evocontacts.vcf
Traceback (most recent call last):
  File "../import", line 32, in <module>
    getAddressBook().addContact(vcard)
  File "../import", line 17, in getAddressBook
    sb = dbus.SessionBus()
  File "/usr/lib/python2.5/site-packages/dbus/_dbus.py", line 217, in
__new__
    mainloop=mainloop)
  File "/usr/lib/python2.5/site-packages/dbus/_dbus.py", line 106, in
__new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to
autolaunch D-Bus session: Autolaunch requested, but X11 support not
compiled in.
Cannot continue.

I called the script "import" and it resides in the /media/card/Contacts
folder and I put my evocontacts.vcf in the /media/card/Contacts/abook
directory.  It is the export of around 611 contacts from Evolution.
Thanks for any suggestions.

Brian

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Brian C
Date: Friday, July 11, 2008 - 9:45 am

Brian C wrote:
[a long error message because he didn't run the script from the OM terminal]

Ok, so the script runs now that I realize it must be run from the OM
terminal.  However, it appears to have entered all "null" contacts and
so far none of them appear to have any actual contact info in them.

Brian

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Kalle Happonen
Date: Friday, July 11, 2008 - 12:22 pm

Hi,
I ran into the same problem, but I did get them in now with the script. 
I had two issues actually. The easiest to try
 is to remove the empty lines between the entries in the vCard file, and 
have them all in a long jumble. That solved my last problem.

I did have another problem when I played around with the contacts in 
Evolution on the desktop. I started by exporting the contacts as vCard 
from Wammu. Evolution refused to read those  v2.1 vCards. I then 
exported it as ldif from wammu, and had to make a small change in the 
entries so that evolution read them correctly (adding a cn or smth). 
AFAIK the openmoko contacts is also based on evolution so there might be 
similar problems.

When I tried to import Wammu vCards,  they showed up as null entries on 
openmoko. When I exported the contacts as vCard (3.0) from evolution, 
and removed the empty lines in the vCard file, I could import them to 
openmoko with the script. I'm not sure if the new vCard format helped any. 


Hope it helps,
Kalle

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Al Johnson
Date: Saturday, July 12, 2008 - 4:41 am

It might work from an ssh session if you run:
	dbus-launch scriptname
I haven't tried this though - just guessing based on similar behaviour from 

Blank line removal should be a one-liner - if only I were more familiar with 

Interesting...I remember having similar problems with OpenXchange a couple of 
years ago. It assumed v3 and didn't check the version in the vCard itself. 
You had to pick which interface to use depending on the vCard version. i 
wonder if Evolution Data Server is doing something similar?

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Andreas Dalsgaard
Date: Monday, July 14, 2008 - 5:01 am

If you do not want to delete all the "null" contacts by hand I've made
a script(attached as remove_all_contacts.py) based on Wurps script
which removes all contacts in your addressbook. It should be pretty

Take a quick look at the attached import_contacts.py script, it is
From: Kalle Happonen
Date: Monday, July 14, 2008 - 5:25 am

Hah, thanks for fixing the script. I almost feel ashamed for not 
spending a few minutes to fix it up, but just did vim magic on my 


_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Roland Mas
Date: Monday, July 14, 2008 - 6:09 am

Andreas Dalsgaard, 2008-07-14 14:01:07 +0200 :


Please pardon my intruding into a thread, I just subscribed to the
list.  I have also worked on contacts management, mostly to allow
myself to fix non-ASCII names in a real editor with a real keyboard.

  The result is the attached script, which improves on the previous
ones in the following ways:

- you can run it through SSH, and it looks for a DBUS session;
- you can dump all contacts to a file (a series of concatenated
  vcards);
- you an reload that file (after having altered it), and it'll update
  contacts when they already exist (based on UID) or create
  new contacts otherwise.

  So, basically:

$ scp manage-contacts.py openmoko:
$ ssh openmoko python manage-contacts.py dump > contacts.txt
$ emacs/vim/nano/gedit/whatever contacts.txt
$ ssh openmoko python manage-contacts.py load < contacts.txt

  As far as I'm concerned (look, I'm a Debian integrist, I'm
*supposed* to care about these things :-), my modifications to the
initial script are subject to the WTFPL.

Roland.
-- 
Roland Mas

Plus on en fout, plus y'en a du riz.
  -- Proverbe chinois.
From: Roland Mas
Date: Monday, July 14, 2008 - 6:17 am

Forgot to mention: that feature uses a gross hack, I'd be happy to see
it cleaned up.  I just didn't manage to find the query syntax for the
getContactList() method.

Roland.
-- 
Roland Mas

Le weblog entièrement nu -- http://roland.entierement.nu/
Le photoblog entièrement net -- http://roland.entierement.net/

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: smurfy - phil
Date: Monday, July 14, 2008 - 6:30 am

Please update

http://wiki.openmoko.org/wiki/Import_Vcf_Contacts

with your new versions, if you need space i could place it @my domain 
(like my first version :D)

Phil


_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Roland Mas
Date: Monday, July 14, 2008 - 6:51 am

Space isn't a problem (I uploaded the script to [1]), but I'm
reluctant to create yet another account on yet another website.  Could
you add the link (and maybe rephrase the text on the article to remove
the thing about running from a terminal rather than SSH)?

  Thanks,

Roland.

[1] http://www.placard.fr.eu.org/~roland/tmp/manage-contacts.py
-- 
Roland Mas

  ()    Campagne du ruban ASCII :
  /\    Contre les mails en HTML et les vcard !

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Stroller
Date: Wednesday, July 9, 2008 - 9:33 am

Further to the recent "questions about our mailinglists" thread, ISTM  
that this is more suitable for device-owners than the wider community  
list.

Stroller.
  

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: "Marco Trevisan (Treviño)"
Date: Monday, July 14, 2008 - 8:43 pm

What about using GTK contacts [1]?
It runs both on PC and in Openmoko and it should allow you to manage 
your contacts in a better way. I've used in my PC to import my old 
mobile phone contacts and I figure it will work well also in a 
Freerunner... :P


[1] http://pimlico-project.org/contacts.html


-- 
Treviño's World - Life and Linux
http://www.3v1n0.net/


_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: C R McClenaghan
Date: Wednesday, July 16, 2008 - 10:35 am

All,

I get the following error using manage-contacts.py in the following  
way from SSH:

  python manage-contacts.py load <vCards.vcf

[removed listing of first vcard entry]

Traceback (most recent call last):
   File "manage-contacts.py", line 92, in <module>
     load_contacts ()
   File "manage-contacts.py", line 61, in load_contacts
     ab.addContact (contacts [k])
   File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 140,  
in __call__
     **keywords)
   File "/usr/lib/python2.5/site-packages/dbus/connection.py", line  
607, in call_blocking
     message, timeout)
dbus.exceptions.DBusException:  
org.freedesktop.DBus.Error.UnknownMethod: Method "addContact" with  
signature "s" on interface  
"org.gnome.evolution.dataserver.addressbook.Book" doesn't exist

I have installed via opkg python-dbus per wiki instructions.

Thoughts?

Chris



_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Al Johnson
Date: Wednesday, July 16, 2008 - 12:49 pm

Try it from the terminal on the phone, or try:
	dbus-load python manage-contacts.py load <vCards.vcf
I'm guessing on the last one as it sorts similar errors with gconftool-2 in 



_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Roland Mas
Date: Wednesday, July 16, 2008 - 1:24 pm

Nah, the manage-contacts.py script does magic to avoid that need.  On
the other hand, I'm playing with Python and Dbus for something else
(to disable suspend when you're talking on the phone), and I have
similar unexpected errors on other Dbus interfaces.  I'm still trying
to debug that.

Roland.
-- 
Roland Mas

Sauvez un arbre, tuez un castor.

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Alexander Lehner
Date: Thursday, July 17, 2008 - 7:06 pm

I'm currently working on a way to get my SQL address database into the 
phone and therefore making heavy use of the scripts mentioned here:

http://wiki.openmoko.org/wiki/Import_Vcf_Contacts

Thanks to the contributors so far, here's my part:

- ssh/BT session:
dbus-launch <script>
doesn't seem to work, in fact the error message is even yet more 
misleading (getContactList with signature 's' and so on).

Instead, the way of the manage-contacts.py script seems to work pretty 
well. It simply requires to add the following lines at the start of the 
program:

ps = os.popen ('ps auxwwwwe | grep -m 1 DBUS_SESSION_BUS_ADDRESS')
l = ps.read ()
r = re.compile ('DBUS_SESSION_BUS_ADDRESS=(\S+)')
m = r.search (l)
a = m.expand ('\\1')
os.environ ['DBUS_SESSION_BUS_ADDRESS'] = a

I would encourage to update the existing scripts with 
this mechanism if it prooves (remove-contacts, manage-contacts worked for 
me this way).

In cases it still doesn't work, there's another alternative instead of 
using the moko terminal, described here:
http://wiki.openmoko.org/wiki/Import_Sim_Contacts

- unicode/UTF8
I managed to convert vcard fields into proper UTF-8 (from plain ASCII). 
But it seems to me that UTF-8 conversion is not well supported with the 
basic (python) set-up on the phone. I had to do this on my linux host.
Also, the resulting characters were not correctly displayed in my case 
even though contacts import did not complain (any experience here whether 
display of e.g. german umlaute works?)

I will post my SQL->phone script next days when it's finished (still 
working on extensions like mobile/work/email etc).

Alex.


_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Roland Mas
Date: Friday, July 18, 2008 - 12:24 am

To be honest, the main reason I wrote manage-contacts.py was to be
able to edit contacts on my main computer :-)  I'm frightened enough
by the input method of the Freerunner, I don't even want to think

  No umlaute here, but I do have some French accented letters such as
é and è and aven one æ, and they display fine.  I even tried typing my
Japanese teacher's name in Japanese, but apparently there's no
Japanese-capable font in OM2007.2 so far.

  While I'm at it: it might be interesting setting a proper locale
name in /etc/profile, so contacts are sorted according properly.  I
did that with "export LANG=fr_FR.UTF-8", so names starting with É sort
among the names starting with E rather than at the very end.  The
backside of that is that agpsui tries to interpret gpsd's output as
fr_FR, with its decimal separator set to a comma rather than a dot,
and therefore wrong data comes out.  But I suspect that's just a bug.

Roland.
-- 
Roland Mas

/* Halley */ (Halley's comment.)

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Jeffrey Ratcliffe
Date: Sunday, July 20, 2008 - 11:13 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I have the same problem, and additionally, the dump option runs
without error, but also without output.

Any ideas?

Regards

Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIg4AnVDAgnE3XzJMRAqH6AKDXiSOCK+E363Lf0GRvlPfQidDrWwCbBo1g
l/fF+S+9nZyHIc264yYXbgs=
=pHkr
-----END PGP SIGNATURE-----

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: Roland Mas
Date: Sunday, July 20, 2008 - 11:53 am

Strange.  It still works here.  You do have openmoko-contacts2
installed, right?  You're not using ASU or Qtopia or something?

Roland.
-- 
Roland Mas

Despite rumour, Death isn't cruel - merely terribly, terribly good at his job.
  -- in Sourcery (Terry Pratchett)

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
From: C R McClenaghan
Date: Sunday, July 20, 2008 - 8:12 pm

When I list the commands on the FR it shows openmoko-contacts, but  
when I opkg install openmoko-contacts2, it tells me I'm up to date.  
I'm using the 2007.2 build of 7/18, not ASU or qtopia. I'll do some  
digging around to see if dbus is active or other stuff before I try it  
again. I assume you meant dbus when you said daemon in your other reply.

Chris



_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
Previous thread: Found it.(GSM antenna port) by Scott Derrick on Wednesday, July 9, 2008 - 8:03 am. (4 messages)

Next thread: Better keyboard? by Arne Zachlod on Wednesday, July 9, 2008 - 9:27 am. (25 messages)