/usr/share/doc/gammu-doc/examples/addfile.py is in gammu-doc 1.31.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/usr/bin/env python
import gammu
import os
import datetime
import sys
if len(sys.argv) != 3:
print 'This requires two parameters: file to upload and path!'
sys.exit(1)
f = open(sys.argv[1] ,'r')
data = f.read()
sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()
# Check AddFilePart
print "\n\nExpection: Put cgi.jpg onto Memorycard on phone"
file_f = {
"ID_FullName": sys.argv[2],
"Name": os.path.basename(sys.argv[1]),
"Buffer": data,
"Protected": 0,
"ReadOnly": 0,
"Hidden": 0,
"System": 0,
'Finished': 0,
'Folder': 0,
'Level': 0,
'Type': 'Other',
"Pos": 0,
}
while (not file_f['Finished']):
file_f = sm.AddFilePart(file_f)
|