Here is a record of my process of converting, mostly, my old Kaddressbook / Kapi VCard file to Google Contacts.
I have decided to move over to Google contacts as my main address book, at least for a trial stage.
So I needed to get as much of my data from my old address book, Kapi, based on Kabc / Kaddressbook / Kontact. I used it previously because it was the main one supported by my old organizer, a Sharp Zaurus and on my PC. I have not had my Zaurus for quite a few years.
So here are my notes from the conversion process, in case anyone else still needs to do this.
It will be of little use to all but a very few.
The majority of the work was done per:
http://kubuntuforums.net/forums/index.php?topic=3113756.0
This was with Debian Python package: python-vobject version 0.8.1c-3
I had to also remove some strings in notes, as Python's replacements in vobject base.py backslashEscape did not like it.
One issue was a "," in the ORG field.
So trying just "," removal. Could not do globally, since a VCARD field seperator.
My most common usage was ", Inc.", so replaced that case with " Inc.". Would be nice to change only in the ORG rows, but that would require more complexity than I am willing right now. Instead I did:
in vim, my favorite text editor,
repeatedly:
:/^ORG:.*,/s/,/COMMA/g
I recommend learning the q macro feature of vim, so you can "repeatedly" by just doing "500000@a"
Another issue is "\n" in ADR field
repeatedly:
:/^ADR:.*\\n/s/\\n/ -- /g
:/^ADR;.*\\n/s/\\n/ -- /g
Need to handle " " continued second lines.
Could also remove from all " " continued second lines, even though no issue in NOTE: fields.
:/^ .*\\n/s/\\n/ -- /g
Could instead remove \n from all lines following ADR
/^ADR<CR>s/\\n/ -- /ge<CR>j:s/\\n/ -- /ge
I chose second, as I have many newlines in notes. Using a q / @ macro made it doable.
The newlines still stayed "\n" in Google though, so not very clean looking.
If it causes problems when split accross lines, that will be harder to catch.
There was one case of it, which the Python errored on. So I could find it to manually edit.
Also had to clean up leftover bad formatting, most likely from copying and pasting into the addressbook program.
ROLE:Text with extra newline at end\r\n
ROLE:Text with extra newline at end\r\n - More text
ORG:Text with extra newline / return at end\r
TEL;TYPE=home:(###)###-####\r --
N:Family_name\r;Given_name;;;
N:Family_name\n;Given_name;;;
etc.
I just deleted one line of this form, since it did not make sense:
LABEL;TYPE=work:#####\r -- Address Text.
More non-fatal, but data losing issues:
Comma seems also to be an issue in NOTE: ROLE:, TEL, NICKNAME:, and EMAIL: fields. It does not error, but it truncates at the comma.
repeatedly:
:/^NOTE:.*,/s/,/COMMA/g
:/^ROLE:.*,/s/,/COMMA/g
:/^TEL.*,/s/,/COMMA/g
:/^NICKNAME.*,/s/,/COMMA/g
:/^ .*,/s/,/COMMA/g
Space may be used in second line of many fields, but few where commas are allowed that I know of. One that caused problems is CATEGORIES.
So, manually find:
:s/COMMA/,/g
and I hope I caught all of them.
EMAIL is a special case, because used publically. So instead of "COMMA", change to " ".
repeatedly:
:/^EMAIL:.*,/s/,/ /g
Semicolon seems also to be an issue in NOTE: field, if at end of line, or in the case seen followed be a space at end of line ("; ), that is continued. It does not error, but it truncates at the semicolon, and adds a \.
Manually edited.
Change X-KADDRESSBOOK-X-IMAddress: to X-JABBER
:/^X-KADDRESSBOOK-X-IMAddress:/s/X-KADDRESSBOOK-X-IMAddress:/X-JABBER:/
Items tried to change, but did not seem to work:
Change X-KADDRESSBOOK-X-Gender: to X-GENDER
:/^X-KADDRESSBOOK-X-Gender:/s/X-KADDRESSBOOK-X-Gender/X-GENDER/
Change X-KADDRESSBOOK-X-Children: to X-CHILDREN:
:/^X-KADDRESSBOOK-X-Children:/s/X-KADDRESSBOOK-X-Children:/X-CHILDREN:/
Remove commas and semicolons
:/^X-CHILDREN:.*,/s/,/ /g
:/^X-CHILDREN:.*;/s/;/ /g
Here are ones that are not easily converted. Could add to Note section manually, but too much work for me.
Details: Office
X-KADDRESSBOOK-X-Office:
Details: Profession
X-KADDRESSBOOK-X-Profession:
Details: Manager's name
X-KADDRESSBOOK-X-ManagersName:managers name
Details: Assistant's name
X-KADDRESSBOOK-X-AssistantsName:assistants name
Misc: Keys: not used by me.
KEY;TYPE=PGP:
Images: Photo/Logo as URL not tested.
GEO:
a standard form, seems, but not supported by Google.
Details: Department
X-KADDRESSBOOK-X-Department:
often contains commas.
ORG:organization;department should be used.
Then follow the procedure in
http://kubuntuforums.net/forums/index.php?topic=3113756.0
Once I got an acceptably good vcf file, I deleted all my old Google contacts (from a previous half-hearted import attempt, by going to Google Voice. There allows deleting all at once, as opposed to contacts.gooogle.com, which only lets one page at a time be deleted.
Then imported the file.
Then lamented how long this took, and that I am still missing data.
Ah, well. Good enough.
No comments:
Post a Comment