Three days ago, I got my Nokia N9 and everything was fine.
One day later I flashed PR1.2 onto it. This broke Contact synchronization via Exchange. No matter what I tried, I couldn’t get it to work.
The synchronization not working is one thing, but not having the contacts on the phone at all is pretty bad, so I needed to find a way to bring them on there.
The N9 doesn’t support importing contacts from any files. The next best thing that came to my mind, were QrCodes.
Easy-peasy, just open up Google contacts, point the phone camera to the QrCodes of one contact after another and save it. But wait! Google Contacts doesn’t show any QrCodes. So I had to generate them myself. Of course I could upload the exported file with all contacts to a website and get back the Codes, but that’d mean that I’d transfer all my contact data to some strange website - not an option either.
The Linux program qrencode can convert contact data to a QrCode. That’s easy enough. Just use:
qrencode -o name.png “`cat name.vcf`”
Toying around, I found that Vcard was the only format supported by both Google Contacts export and the N9 Qr Code program.
So, the last problem I had, was that I’d have to download every contact’s vcard file. That’s a lot of work.
I ended up, exporting all the contacts at once and writing a Python program to separate the data into files for each contact:
(It’s uggly code, I’m not using Python that often…)
from vobject import readComponents
file = open(‘contacts.vcf’)
io = StringIO.StringIO(file.read())
string = io.getvalue()
for vcard in readComponents(string):
filename = vcard.fn.value+”.vcf”
filename = filename.replace(” “, “.”)
filename = filename.lower()
out = open(filename, ‘w’)
v = str(vcard.serialize())
Afterwards, I used a (very small) Shellscript to generate the png files:
for line in *.vcf;
qrencode -o $line.png “`cat $line`”
(You can use my code under the WTF Public License 2.0 http://sam.zoy.org/wtfpl/COPYING)