4 # Converts a vCard address book into abook addressbook format
6 # Author: Gavin Costello
13 cfile = open('contacts.vcf', 'r')
14 for line in cfile.readlines():
15 if (line.startswith('FN')):
17 name = line.split(':')[1]
20 print u'name=%s' % unicode(name, "utf-8"),
21 if (line.startswith('EMAIL')):
22 email = line.split(':')[1]
23 print u'email=%s' % email,
24 if (line.startswith('TEL')):
25 tel = line.split(';')[1]
26 fulltype = tel.split('=')[1]
27 type = fulltype.split(':')[0]
28 #print u'type=%s' % type,
29 phone = line.split(':')[1]
30 if (type.endswith('CELL')):
31 print u'mobile=%s' % phone,
32 elif (type.endswith('HOME')):
33 print u'phone=%s' % phone,
34 elif (type.endswith('WORK')):
35 print u'work=%s' % phone,