#!/bin/env python """Create many ical appointments for testing the KDE Kolab Client. Redirect the output in a file and import this from the KDE Kolab Client. You need to adapt the script, e.g. start time, how many appointments and email addresses of the organizer and attendee. This script is Free Software under the GNU General Public License >=v2. bernhard@intevation.de """ #20030721 Bernhard initial (0.1) __version__="$Revision: 1.2 $"[10:-1] import time # note because of the inverse time conversion functions # mktime() and localtime() this _might_ behave differently from UTC startingtimestring="20081110T214600Z" increment_seconds=60*5 basenumber=30000 how_many=12*100 # 14 hours t=time.strptime(startingtimestring,"%Y%m%dT%H%M%SZ") seconds=time.mktime(t) header="""BEGIN:VCALENDAR PRODID :-//K Desktop Environment//NONSGML libkcal 3.1//EN VERSION :2.0""" footer="""\nEND:VCALENDAR""" dayfmt="""\nBEGIN:VEVENT ORGANIZER :MAILTO:bernhard8.reiter@moritz.kolab.org ATTENDEE ;CN=Bernhard8 Reiter ;RSVP=FALSE ;PARTSTAT=ACCEPTED ;ROLE=REQ-PARTICIPANT :mailto:bernhard8.reiter@moritz.kolab.org SEQUENCE :0 DESCRIPTION :Mass test SUMMARY :A five minute appointment #%d CLASS :PUBLIC PRIORITY :3 DTSTART :%s DTEND :%s TRANSP :OPAQUE BEGIN:VALARM DESCRIPTION : ACTION :DISPLAY TRIGGER ;VALUE=DURATION :-PT1M END:VALARM END:VEVENT""" print header for i in range(how_many): starts=seconds+increment_seconds*i stops=seconds+increment_seconds*(i+1) starttime=time.strftime("%Y%m%dT%H%M%SZ", time.localtime(starts)) endtime= time.strftime("%Y%m%dT%H%M%SZ", time.localtime(stops)) day= dayfmt % (basenumber+i,starttime, endtime) print day print footer