events.append( icalendar.Event( summary=icalendar.vText( '{}: {}'.format(lab.code, lab.name) if any( c.isdigit() for c in lab.code) else lab.name), location=icalendar.vText( "{} - {}".format(lab.location, cued_address) if lab.location else cued_address), dtstart=icalendar.vDatetime( timezone.localize(startt).astimezone(pytz.utc)), dtend=icalendar.vDatetime( timezone.localize(endt).astimezone(pytz.utc)), dtstamp=icalendar.vDatetime(last_updated), uid='{code}-{i}.d{day}.{term}.{part}@efw27.user.srcf.net' .format(i=i, code=lab.code, day=(day - timetable.dates[0]).days, term=term, part=course_year.part), description=icalendar.vText( '{}Feedback: http://www-g.eng.cam.ac.uk/ssjc/labs.html' .format("Information: {}\n\n". format(lab.link) if lab.link else "")))) return events if __name__ == '__main__': from objects import CourseYear print(construct(CourseYear.get('ib', 2014), 'lent', '142-144').to_ical())
def ia_term_calendar(year, part, term, group): course_year = CourseYear.get(part, year) return calendarmaker.construct(course_year, term, group)
def ia_term_table(year, part, term): timetable = CourseYear.get(part, year).term(term) return dict(tt=timetable)
def ia_term_calendar(year, part, term): course_year = CourseYear.get(part, year) return calendarmaker.construct(timetable, term, examples=True)
), location=icalendar.vText( "{} - {}".format(lab.location, cued_address) if lab.location else cued_address ), dtstart=icalendar.vDatetime(timezone.localize(startt).astimezone(pytz.utc)), dtend= icalendar.vDatetime(timezone.localize(endt).astimezone(pytz.utc)), dtstamp=icalendar.vDatetime(last_updated), uid='{code}-{i}.d{day}.{term}.{part}@efw27.user.srcf.net'.format( i=i, code=lab.code, day=(day - timetable.dates[0]).days, term=term, part=course_year.part ), description=icalendar.vText( '{}Feedback: http://www-g.eng.cam.ac.uk/ssjc/labs.html'.format( "Information: {}\n\n".format(lab.link) if lab.link else "" ) ) )) return events if __name__ == '__main__': from objects import CourseYear print(construct(CourseYear.get('ib', 2014), 'lent', '142-144').to_ical())