Commit 857e122f authored by Maxime Bombar's avatar Maxime Bombar

RFC compliance

parent ebdcd614
......@@ -20,12 +20,20 @@ import re
import argparse
import uuid
# today's week beginning date
today = datetime.datetime.strptime(
datetime.datetime.now().strftime('%y-W%W') + '-1', "%y-W%W-%w"
).strftime('%y-%m-%d')
def new_calendar():
c = Calendar()
c.add('prodid', '-//Maxime Bombar//Agreg Maths ENS Cachan//FR') # RFC compliance
c.add('version', '2.0') # RFC compliance
return c
def get_schedule(a):
"""
returns a list of the schedule for the 5 days of the week
......@@ -214,6 +222,8 @@ def fill_calendar(c, days, date):
dtend = day_date.replace(hour=h_end, minute=m_end)
e.add('dtstart', dtstart)
e.add('dtend', dtend)
e.add('dtstamp', datetime.datetime.now())
e.add('uid', uuid.uuid1().hex)
c.add_component(e)
......@@ -291,13 +301,13 @@ if __name__ == '__main__':
pretty_print(days, date)
else:
c = Calendar()
c = new_calendar() # RFC Compliance
fill_calendar(c, days, date)
print(c.to_ical().decode('utf-8'))
else:
# fetch every week !
c = Calendar()
c = new_calendar() # RFC Compliance
while date.month < 7 or date.year == 2018:
date_str = date.strftime('%y-%m-%d')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment