The Blizzard of Oz snow day gave me a chance to get my taxes done yesterday, and today I used the time to scratch a long-standing itch to clean up my contacts, which have been a bit of a mess since I merged two sources into one.
When I got my first android phone, a G1, I used the Google Contacts Data API to write hipg.py for migrating my sidekick/hiptop contacts to gmail contacts. Then I grew disappointed with the G1 and went back to the sidekick. And then Microsoft bought Danger and lost everybody's sidekick contacts for a week or so. They restored some of the data, but all my street addresses were gone. I had back-ups, of course; I know better than to completely trust any cloud provider. But I hadn't written code to restore from my back-ups. So I lived without street addresses in my phone for a while.
Then I got another android phone, a Samsung Galaxy S Vibrant. I migrated the sidekick contacts again, and then, to get the street addresses, I imported the contacts from the G1 days. Google's merge tools cleaned things up to a tolerable level, but they left 2 issues:
- Duplicate phone numbers like:
- Duplicated notes like:
like they should be
I fixed a few of these by hand, but knowing that I could get the computer to do them all in batch has been itching at me for a while.
It took just a few hours and a couple hundred lines of python to scratch that itch today with contact_fix.py.
475:c87196981537 2011-02-02 fix all_contacts (self.)
474:80739018dbfa 2011-02-02 - make group optional; default to all
473:61412465cfed 2011-02-02 - fix duplicate phone numbers as well as doubled notes
472:01c2becd5cfb 2011-02-02 batch edit works/tested in one case
471:e7840a73836d 2011-02-02 batch edit operation (tested non-destructively)
470:e4e531aae635 2011-02-02 run fix_note() on data from the server
469:2ec84b8d0363 2011-02-02 - print names of contacts in a group
468:b919239097e7 2011-02-02 contact_fix.py can login and get contact data
I'm also working on archiving my contacts using hCard. More on that soon, I hope.