From b7d654b59de564051ecd92327d9162a43ac97ee9 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 15 Aug 2022 20:01:55 +0200 Subject: [PATCH] wip ics --- src/io.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/io.rs b/src/io.rs index 00bd93b..45ba827 100644 --- a/src/io.rs +++ b/src/io.rs @@ -1,4 +1,7 @@ -use ics::{Event, ICalendar}; +use ics::{ + properties::{Class, Description, DtEnd, DtStart, Location, Summary, Transp}, + Event, ICalendar, +}; type T = Vec; type D = std::collections::HashMap< @@ -9,8 +12,26 @@ type D = std::collections::HashMap< pub fn export(_timetable: T, _dates: D) -> ICalendar<'static> { let mut calendar = ICalendar::new("2.0", "cal8tor"); - let event = Event::new("uid", "dtstamp"); + // Create event which contains the information regarding the course + let mut event = Event::new("uid", "dtstamp"); + // Add properties + // Public event + event.push(Class::public()); + // Consume actual time + event.push(Transp::opaque()); + // Professor's name + event.push(Description::new("Jean-Jacques Bourdin")); + // Start time of the course + event.push(DtStart::new("20220919T123000Z")); + // End time of the course + event.push(DtEnd::new("20220919T033000Z")); + // Room location + event.push(Location::new("A188")); + // Course's name + event.push(Summary::new("Algorithmique avancée")); + + // Add the course to the calendar calendar.add_event(event); calendar.save_file("target/debug2.ics").unwrap();