From: Roger B. <ro...@ro...> - 2003-03-26 06:21:02
|
> and ship them over to the phone. I started to write a perl script to > convert my current contact lists (CSV format) to the index format BitPim > uses..... then I realized how hard it would be to calculate the offsets and > gave up... I don't envy you. :) What offsets? The index.idx file that bitpim uses is just a dump of a Python dict (called a map in Perl I believe). The format is: results['phonebook']={ recordnum: recordvalue, } recordnum is an integer, just have no duplicates. They don't need to be sequential. Bitpim uses this to refer to records internally rather than something more obvious like the name since the phone allows duplicate names. The recordvalue format is: { field: value, field: value } Strings are quoted with single or double quotes. Here is a blank record. You only need to update the fields you want. blankentry={ 'name': "", 'group': 0, 'type1': 0, 'type2': 0, 'type3': 0, 'type4': 0, 'type5': 0, 'number1': "", 'number2': "", 'number3': "", 'number4': "", 'number5': "", 'email1': "", 'email2': "", 'email3': "", 'memo': "", 'msgringtone': 0, 'ringtone': 0, 'secret': False, 'serial1': 0, 'serial2': 0, 'url': "", '?offset00f': 0, '?offset028': 0, '?offset111': 0, '?offset20c': 0 } Do not set the serial fields. The offset fields are actually offsets into the record of data returned in the phonebook protocol. One of them is the pictureid. The rest I don't know (and are probably bits of preceding fields where I have been too conservative in working out size. You'll probably want to set the type and group fields. These are integers. To see the values for the type, look at the top of this file: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/bitpim/bitpim/com_lgvx4400.py numbertypetab on line 28 has the mappings. groupdict on line 60 has the default group to integer mappings (although they will be different if you have edited the groups on your phone). Once you have generated the index.idx file, just dump it in the bitpim phonebook directory. You may also want to check the readme for maximum field lengths since you will currently get an exception if you exceed them. Roger |