File: getallcalendar.py

package info (click to toggle)
gammu 1.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 21,972 kB
  • ctags: 8,504
  • sloc: ansic: 104,965; pascal: 7,209; cpp: 4,023; python: 3,639; php: 1,622; sh: 1,534; sql: 450; cs: 260; makefile: 192; perl: 107; asm: 31
file content (36 lines) | stat: -rwxr-xr-x 780 bytes parent folder | download | duplicates (3)
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
# Example for reading calendar from phone

import gammu

# Create object for talking with phone
sm = gammu.StateMachine()

# Read the configuration (~/.gammurc)
sm.ReadConfig()

# Connect to the phone
sm.Init()

# Get number of calendar entries
status = sm.GetCalendarStatus()

remain = status['Used']

start = True

while remain > 0:
    # Read the entry
    if start:
        entry = sm.GetNextCalendar(Start = True)
        start = False
    else:
        entry = sm.GetNextCalendar(Location = entry['Location'])
    remain = remain - 1

    # Display it
    print
    print '%-20s: %d' % ('Location',entry['Location'])
    print '%-20s: %s' % ('Type',entry['Type'])
    for v in entry['Entries']:
        print '%-20s: %s' % (v['Type'], str(v['Value']))