aboutsummaryrefslogtreecommitdiff
path: root/src/ics.ml
AgeCommit message (Collapse)Author
2022-02-05ics: introduce functions to filter courses without locationAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05ics: make Ics.t publicAlban Gruin
To simplify code down the line, this makes Ics.t public so everyone can apply standard list processing functions onto it. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-10-04course, ics: location may be empty, make it an optionAlban Gruin
As there may not be a location, make it an option type so we can easily add a warning in the title of an event. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-20ics, ucs: generate event IDs with a random numberAlban Gruin
Until now, ucs generated unique IDs with the datetime and the number of an event, starting by 0. Unfortunately, if two calendars were generated at the same second, they could have collisions. To avoid that, the ICS generator now uses a base ID generated randomly, which should be enough to avoid collisions. The RNG is self-initialised in the main function. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-20ics: fix issues with EOLsAlban Gruin
End of lines in iCalendar files should be CRLF, but some (most?) lines generated by µCS were LF. This changes that. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server, ics, pages: allow to generate ICS from modulesAlban Gruin
This adds the ability to generate an ICS file from a module ID, and to filter it based on its groups. To do this, you can enter a module ID on the frontpage. Then, µCS will fetch the timetable, then return a page where one can select the group(s) they want to filter (this is enabled by the new Ics.get_all_groups function). Then, µCS is able to generate a link to that calendar, not unlike with a single group ID. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server, ics: add a facility to filter courses by groupsAlban Gruin
When fetching courses based on their module ID, it is interesting to exclude coruses that do not apply to some groups. This adds the functionnality to apply that filtering, with the Ics.filter_groups function. It also becomes possible to get ICS for modules. URLs and generators are changed accordingly. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19course, ics: read, store, and dump groups in a courseAlban Gruin
In the future, we want to filter courses by its groups. To allow this, we must parse and store the groups from celcat. This adds this feature. We also dump them in the `COMMENT' field of the iCalendar files. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-12-30ics: print the timezone name in the ICS fileAlban Gruin
Add the correct timezone in generated ICS files. The timezone is fetched from /etc/timezone. Even though this is not standard, if a tool needs it, it should be able to understand it correctly. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-14ics: timestamps are in local time, not UTCAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12Remove unused functions and useless type specificationsAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12ics: split long lines according to the iCalendar specificationAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-11ics: clean Event module, conversion to stringAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-09course, ics: proper modules, proper datetime storageAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>