Skip to content

Instantly share code, notes, and snippets.

@quizzmaster
Forked from myles/gtalug_ics.py
Created September 7, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quizzmaster/5cbecc11e0bbe48407ad6c2ea63bd2b0 to your computer and use it in GitHub Desktop.
Save quizzmaster/5cbecc11e0bbe48407ad6c2ea63bd2b0 to your computer and use it in GitHub Desktop.
A simple Python script that generates the GTALUG ICS (or iCal) file at <http://gtalug.org/gtalug.ics>.
#!/usr/bin/env python
import vobject
import datetime
from pytz import timezone
from dateutil import rrule
TIME_ZONE = timezone('US/Eastern')
TODAY = datetime.date.today() - datetime.timedelta(days=31)
MEETING_START_TIME = datetime.time(19, 30, tzinfo=TIME_ZONE)
MEETING_END_TIME = datetime.time(21, 30, tzinfo=TIME_ZONE)
MEETINGS = list(rrule.rrule(rrule.MONTHLY, count=5, byweekday=(rrule.TU), bysetpos=2))
cal = vobject.iCalendar()
for m in MEETINGS:
url = "http://gtalug.org/wiki/Meetings:%s-%s" % (m.year, m.strftime("%m"))
event = cal.add('vevent')
event.add('summary').value = "GTALUG Meeting"
event.add('description').value = "Check the website for any updated information: " + url
event.add('url').value = url
event.add('dtstart').value = datetime.datetime.combine(m.date(), MEETING_START_TIME)
event.add('dtend').value = datetime.datetime.combine(m.date(), MEETING_END_TIME)
print cal.serialize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment