import sys
-def output_info(info):
+def output_info(info, pos):
if info.has_key('X-EVOLUTION-FILE-AS'):
result = info['X-EVOLUTION-FILE-AS']
elif info.has_key('N'):
print >> sys.stderr, 'No suitable name for', info
return
- result += ';;ME;;5'
+ result += ';;ME;%i;5' % pos
id = 0
kf = k.split(';')
type = 0
if len(kf) > 1:
- if kf[1].startswith('TYPE=HOME'):
+ if 'TYPE=HOME' in k:
type = 2
- elif kf[1].startswith('TYPE=CELL'):
+ elif 'TYPE=CELL' in k:
type = 3
- elif kf[1].startswith('TYPE=WORK'):
+ elif 'TYPE=WORK' in k:
type = 6
if kf[0] == 'ADR':
print result
+pos = 1
info = {}
for line in open(sys.argv[1]):
if not line or line[0] == ' ':
if key == 'BEGIN':
info = {}
elif key == 'END':
- output_info(info)
+ output_info(info, pos)
+ pos += 1
if value:
info[key] = value.strip()