Migrating calendars from horde to zarafa
Modifiziertes Skript, verschiebt alle Termine um die in timedelta angegebene Zeit:
#!/usr/bin/python # -*- coding: utf-8 -*-
import sys from icalendar import Calendar, Event from datetime import timedelta
# events are off by two hours timedelta=timedelta(hours=-1)
# default ical_file="test.ical"
# input file try: ical_file=sys.argv[1] except IndexError: pass
cal = Calendar.from_ical(open(ical_file,'rb').read()) for component in cal.walk(): if component.name == "VEVENT": try: #component['rrule'] dtstart = component.decoded('dtstart') dtend = component.decoded('dtend') new_dtstart=dtstart + timedelta new_dtend =dtend + timedelta new_cal=Calendar() new_cal.add('dtstart',new_dtstart) new_cal.add('dtend',new_dtend) component['dtstart']=new_cal['dtstart'] component['dtend']=new_cal['dtend'] except KeyError: pass
new_ics_filename = "corrected_" + ical_file newics_file = open(new_ics_filename, 'wb') cal_as_ical=cal.to_ical() newics_file.write(cal_as_ical) newics_file.close()
Braucht python-setuptools && easy_install icalendar