def make_ical_from_groupid(group_id): gehol_proxy = GeholProxy() cal = gehol_proxy.get_studentset_calendar(group_id, "1-14") ical = convert_geholcalendar_to_ical(cal, first_monday) ical_data = ical.as_string() outfile = "%s.ics" % ical.name print "writing ical file : %s" % outfile write_content_to_file(ical_data, outfile)
def make_ical_from_url(name, url): gehol_proxy = GeholProxy() cal = gehol_proxy.get_studentset_calendar_from_url(url) ical = convert_geholcalendar_to_ical(cal, first_monday) ical_data = ical.as_string() outfile = "%s.ics" % name print "writing ical file : %s" % outfile write_content_to_file(ical_data, outfile)
def make_ical_from_local_file(filename): f = open(filename) cal = StudentSetCalendar(f) print cal.header_data pprint(cal.events) ical_content = convert_geholcalendar_to_ical(cal, first_monday) write_content_to_file(ical_content, "%s.ics" % cal.description)
def convert_professor_calendar_to_ical_string(cal): try: ical_data = convert_geholcalendar_to_ical(cal, conf.FIRST_MONDAY) return ical_data.as_string() except Exception,e: return None
def convert_course_calendar_to_ical(cal): ical = convert_geholcalendar_to_ical(cal, conf.FIRST_MONDAY) return ical.as_string()
import sys sys.path.append("../src") from gehol import GeholProxy from gehol.converters.utils import write_content_to_file from gehol.converters.rfc5545icalwriter import convert_geholcalendar_to_ical if __name__=="__main__": print 'import calendar test --> csv files' all_courses = ['INFOH500','BIMEH404','STATH400', 'COMMB411', 'TRANH100', 'INFOH100', 'TRANH100'] host = '164.15.72.157:8081' first_monday = '19/09/2011' gehol_proxy = GeholProxy(host) for course in all_courses: print "fetching events for course %s" % course cal = gehol_proxy.get_course_calendar(course) dest_filename = '%s.ics' % course ical = convert_geholcalendar_to_ical(cal, first_monday) print "Saving %s events to %s" % (course, dest_filename) ical_data = ical.as_string() write_content_to_file(ical_data, dest_filename)