]> piware.de Git - bin.git/blobdiff - vcard2gnokii
rewrite backup script in shell and with fixed weekly/monthly logic
[bin.git] / vcard2gnokii
index 034f99d241e1e2e9a06940d5fddc2373c3293944..f3cef82ccf258d50f1a8d1b111b44c636278d083 100755 (executable)
@@ -2,7 +2,7 @@
 
 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'):
@@ -12,7 +12,7 @@ def output_info(info):
        print >> sys.stderr, 'No suitable name for', info
        return
 
-    result += ';;ME;;5'
+    result += ';;ME;%i;5' % pos
 
     id = 0
 
@@ -20,11 +20,11 @@ def output_info(info):
        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':
@@ -43,6 +43,7 @@ def output_info(info):
 
     print result
 
+pos = 1
 info = {}
 for line in open(sys.argv[1]):
     if not line or line[0] == ' ':
@@ -60,6 +61,7 @@ for line in open(sys.argv[1]):
        if key == 'BEGIN':
            info = {}
        elif key == 'END':
-           output_info(info)
+           output_info(info, pos)
+            pos += 1
     if value:
        info[key] = value.strip()