예제 #1
0
파일: ics_diff.py 프로젝트: long3841/gus
def main():
    options, args = getOptions()
    if args:
        ignore_dtstamp = options.ignore
        ics_file1, ics_file2 = args
        cal1 = base.readOne(file(ics_file1))
        cal2 = base.readOne(file(ics_file2))
        deleteExtraneous(cal1, ignore_dtstamp=ignore_dtstamp)
        deleteExtraneous(cal2, ignore_dtstamp=ignore_dtstamp)
        prettyDiff(cal1, cal2)
예제 #2
0
def main():        
    options, args = get_options()
    if PyICU is None:
        print "Failure. change_tz requires PyICU, exiting"
    elif options.list:
        for tz_string in PyICU.TimeZone.createEnumeration():
            print tz_string
    elif args:
        utc_only = options.utc
        print "Converting %s events" % "only UTC" if utc_only else "all"
        ics_file = args[0]
        timezone = PyICU.ICUtzinfo.getInstance(args[1]) if len(args) > 1 else PyICU.ICUtzinfo.default
        print "... Reading %s" % ics_file
        cal = base.readOne(file(ics_file))
        change_tz(cal, timezone, PyICU.ICUtzinfo.default, utc_only)
        
        out_name = ics_file + '.converted'
        print "... Writing %s" % out_name
        out = file(out_name, 'wb')
        cal.serialize(out)
        print "Done"