~menesis/ubuntu/maverick/gtimelog/maverick

« back to all changes in this revision

Viewing changes to export-my-calendar.py

  • Committer: Bazaar Package Importer
  • Author(s): Barry Warsaw
  • Date: 2010-09-10 10:12:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100910101203-r7epgzni3537hkxw
Tags: 0.4.0-0ubuntu1
New packaging for new upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python2.3
2
 
"""
3
 
Experimental script to export GTimeLog data to iCalendar file.
4
 
"""
5
 
import os
6
 
import datetime
7
 
import gtimelog
8
 
 
9
 
# Hardcoded date range and output file
10
 
d1 = datetime.datetime(2005, 2, 1)
11
 
d2 = datetime.datetime.now()
12
 
outputfile = 'calendar.ics'
13
 
 
14
 
settings = gtimelog.Settings()
15
 
configdir = os.path.expanduser('~/.gtimelog')
16
 
settings_file = os.path.join(configdir, 'gtimelogrc') 
17
 
if os.path.exists(settings_file):
18
 
    settings.load(settings_file)
19
 
timelog = gtimelog.TimeLog(os.path.join(configdir, 'timelog.txt'),
20
 
                           settings.virtual_midnight)
21
 
window = timelog.window_for(d1, d2)
22
 
window.icalendar(open(outputfile, 'w'))