Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 77b5023096ba87b76b5c8641455e044a > files > 8

python-gammu-1.26.1-2mdv2010.0.i586.rpm

#!/usr/bin/env python

import gammu
import sys

if len(sys.argv) != 3:
    print 'This requires two parameters: memory_type and backup file (eg. vcard)!'
    sys.exit(1)

sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()

memory = sys.argv[1]
filename = sys.argv[2]

backup = gammu.ReadBackup(filename)

for item in backup['PhonePhonebook']:
    item['MemoryType'] = memory
    loc = sm.AddMemory(item)
    print 'Added item to location %d' % loc