File: addfile.py

package info (click to toggle)
python-gammu 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 648 kB
  • ctags: 643
  • sloc: ansic: 9,254; python: 1,770; makefile: 77; sh: 8
file content (37 lines) | stat: -rwxr-xr-x 647 bytes parent folder | download | duplicates (4)
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
37
#!/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)