]> piware.de Git - bin.git/commitdiff
vcard2gnokii: track memory position ourselves, for major speedup
authormartin@piware.de <>
Mon, 22 Dec 2008 12:13:45 +0000 (13:13 +0100)
committermartin@piware.de <>
Mon, 22 Dec 2008 12:13:45 +0000 (13:13 +0100)
vcard2gnokii

index 034f99d241e1e2e9a06940d5fddc2373c3293944..4b7ef99378d02e7f4daa5df222ee7a7498f41e1c 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
 
@@ -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()