diff --git a/Cargo.lock b/Cargo.lock index e232722..f4d6d77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,7 @@ dependencies = [ "reqwest", "scraper", "tokio", + "uuid", ] [[package]] @@ -1438,6 +1439,16 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "uuid" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" +dependencies = [ + "getrandom 0.2.7", + "rand 0.8.5", +] + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index b6bc33b..ecc5248 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,10 @@ scraper = "0.13.0" regex = "1" chrono = "0.4" ics = "0.5" + +[dependencies.uuid] +version = "1.1.2" +features = [ + "v4", # Lets you generate random UUIDs + "fast-rng", # Use a faster (but still sufficiently random) RNG +] diff --git a/src/ics.rs b/src/ics.rs index da3c140..5e1717c 100644 --- a/src/ics.rs +++ b/src/ics.rs @@ -8,22 +8,28 @@ pub fn export(courses: Vec, filename: &str) { // Create events which contains the information regarding the course for course in courses { - let mut event = Event::new("uid", "dtstamp"); + let mut event = Event::new(uuid::Uuid::new_v4().to_string(), dt_ical(chrono::Utc::now())); // Public event event.push(Class::public()); + // Consume actual time event.push(Transp::opaque()); + // Professor's name if course.professor.is_some() { event.push(Description::new(course.professor.unwrap())); } + // Start time of the course event.push(DtStart::new(dt_ical(course.dtstart.unwrap()))); + // End time of the course event.push(DtEnd::new(dt_ical(course.dtend.unwrap()))); + // Room location event.push(Location::new(course.room)); + // Course's name event.push(Summary::new(course.name));