Editing Importing Windows Mobile contacts
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
== Import how to == | == Import how to == | ||
- | To import data, we need a backup file created by the approach mentioned in [[Importing data]], the script mentioned in the end of this page and a | + | To import data, we need a backup file created by the approach mentioned in [[Importing data]], the script mentioned in the end of this page and a N900 (or another Maemo5 device). Powerusers don't need to follow this precisely, others do: |
- | # connect N900 to PC using mass storage mode; from PC, create a directory "datatransfer" on the "flash disk device" - and copy the script ( | + | # connect N900 to PC using mass storage mode; from PC, create a directory "datatransfer" on the "flash disk device" - and copy the script (pimbackup2vcf.py) and backup file (e.g. PIMBackup_20091220.pib) to the directory. Unmount and disconnect. |
# on N900, run xterm | # on N900, run xterm | ||
# <pre>cd /home/user/MyDocs/datatransfer; python pimbackup2vcf.py PIMBackup_20091220.pib contacts.vcf</pre> | # <pre>cd /home/user/MyDocs/datatransfer; python pimbackup2vcf.py PIMBackup_20091220.pib contacts.vcf</pre> | ||
Line 11: | Line 11: | ||
== pimbackup2vcf.py == | == pimbackup2vcf.py == | ||
- | < | + | <pre> |
#!/usr/bin/python2.5 | #!/usr/bin/python2.5 | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
Line 54: | Line 54: | ||
def csvline2vcf(row): | def csvline2vcf(row): | ||
rv="" | rv="" | ||
- | rv | + | rv=rv+"BEGIN:VCARD"+'\n' |
- | rv | + | rv=rv+"VERSION:3.0"+'\n' |
rv=addne(rv, "N:", csvf(row, "Name")) | rv=addne(rv, "N:", csvf(row, "Name")) | ||
rv=addne(rv, "FN:", csvf(row, "First Name")+" "+csvf(row, "Last Name")) | rv=addne(rv, "FN:", csvf(row, "First Name")+" "+csvf(row, "Last Name")) | ||
Line 72: | Line 72: | ||
rv=addne(rv, "BDAY:", convdate(csvf(row, "Birthday"))) | rv=addne(rv, "BDAY:", convdate(csvf(row, "Birthday"))) | ||
rv=addne(rv, "X-ANNIVERSARY:", convdate(csvf(row, "Anniversary"))) | rv=addne(rv, "X-ANNIVERSARY:", convdate(csvf(row, "Anniversary"))) | ||
- | rv | + | rv=rv+"END:VCARD"+'\n'+'\n' |
return rv | return rv | ||
Line 87: | Line 87: | ||
zf=zipfile.ZipFile(sys.argv[1]) | zf=zipfile.ZipFile(sys.argv[1]) | ||
- | contactsFN=[fn for fn in zf.namelist() if 'contacts' | + | contactsFN=[fn for fn in zf.namelist() if (fn.find('contacts')!=-1)][0] |
Line 105: | Line 105: | ||
if lineNo==0: | if lineNo==0: | ||
csv_fields=row | csv_fields=row | ||
- | lineNo | + | lineNo=lineNo+1 |
else: | else: | ||
vcf.write(csvline2vcf(row)) | vcf.write(csvline2vcf(row)) | ||
Line 112: | Line 112: | ||
os.remove(TMPFILENAME) | os.remove(TMPFILENAME) | ||
- | </ | + | </pre> |
== Extending the script == | == Extending the script == | ||
Line 118: | Line 118: | ||
The script would, with little modifications, import contacts data from generally any csv file. The csv file has to contain initial line with columns' titles. Data contained in the output VCF file is defined in the '''csvline2vcf(row)''' function - which converts a csv line to a vcf record string. | The script would, with little modifications, import contacts data from generally any csv file. The csv file has to contain initial line with columns' titles. Data contained in the output VCF file is defined in the '''csvline2vcf(row)''' function - which converts a csv line to a vcf record string. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
[[Category:Power users]] | [[Category:Power users]] | ||
- |
Learn more about Contributing to the wiki.