diff --git a/bin/eventPredicates.ml b/bin/eventPredicates.ml index c4f31a0..2021d01 100644 --- a/bin/eventPredicates.ml +++ b/bin/eventPredicates.ml @@ -326,7 +326,7 @@ let all_collectors : collector list = simple_recurrence; ] -let remind_of_event (ev : Icalendar.event list) : (Remind.rem, error) result = +let remind_of_event (source : string) (ev : Icalendar.event list) : (Remind.rem, error) result = let () = if List.length ev = 0 then failwith "No events provided" in let master, recurrence = @@ -339,7 +339,7 @@ let remind_of_event (ev : Icalendar.event list) : (Remind.rem, error) result = end in - let rem = { Remind.empty with Remind.recurring = recurrence } in + let rem = { Remind.empty with Remind.source; Remind.recurring = recurrence } in ListLabels.fold_left ~init:(Ok rem) all_collectors ~f:(fun rem_or_error pred -> match rem_or_error with diff --git a/bin/main.ml b/bin/main.ml index 6904041..abd1f81 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -20,6 +20,7 @@ let ical2rem ical_files = try Printf.eprintf "\nProcessing file: %s\n" filename; let file_content = read_file filename in + let basename = Filename.remove_extension (Filename.basename filename) in match Icalendar.parse file_content with | Error e -> if e <> ": not enough input" then prerr_endline ("Error parsing iCalendar file: " ^ e); @@ -39,7 +40,7 @@ let ical2rem ical_files = let good_rems = Map.fold ~init:[] events_map ~f:(fun ~key:uid ~data:events good_rems -> - let rem_or_error = EventPredicates.remind_of_event events in + let rem_or_error = EventPredicates.remind_of_event basename events in match rem_or_error with | Ok rem -> rem :: good_rems | Error (EventPredicates.Invalid_date s) -> diff --git a/bin/remind.ml b/bin/remind.ml index e466796..f504310 100644 --- a/bin/remind.ml +++ b/bin/remind.ml @@ -11,6 +11,7 @@ type simple_weekly = { (** A simple weekly REM command *) type rem = { + source : string; (** Source file or identifier for the reminder *) original_uuid : string; (** Original UID from the iCalendar event *) summary : string; (** Summary or title of the reminder *) date : Timedesc.Date.t; (** Date specification (day, month, year) *) @@ -28,6 +29,7 @@ type rem = { let empty = { + source = ""; original_uuid = ""; summary = ""; date = Timedesc.Date.Ymd.make_exn ~year:1970 ~month:1 ~day:1;