From 5a4e98ebe9b82c8b4abae3d1e4535fadcfbd8907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 30 Apr 2020 18:35:15 +0200 Subject: Update vcomponent to load into the app object. --- module/vcomponent/load.scm | 55 +++------------------------------------------- 1 file changed, 3 insertions(+), 52 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/load.scm b/module/vcomponent/load.scm index 37d57b56..09dcd3c8 100644 --- a/module/vcomponent/load.scm +++ b/module/vcomponent/load.scm @@ -1,59 +1,10 @@ (define-module (vcomponent load) :export (load-calendars load-calendars*) :use-module (util) - :use-module (util time) :use-module (util config) - :use-module (srfi srfi-1) - :use-module (datetime) - :use-module (datetime util) - :use-module (srfi srfi-41) - :use-module (srfi srfi-41 util) - ;; :use-module (parameters) - ;; :use-module (vcomponent) - :use-module (vcomponent base) - :use-module ((vcomponent parse) :select (parse-cal-path)) - :use-module ((vcomponent recurrence) :select (generate-recurrence-set repeating?)) - :use-module ((vcomponent datetime) :select (ev-timestream regular) - (map generate-recurrence-set repeating) - ))) - -;; Reads all calendar files from disk, generate recurence-sets for all repeating events, -;; and returns a list of calendars, and a stream of all events "ready" for display. -(define* (load-calendars #:optional (calendar-files (get-config 'calendar-files))) - (report-time! "Parsing ~a calendars" (length calendar-files)) - (let* ((calendars regular repeating (load-calendars* calendar-files))) - (report-time! "Calendars loaded, interleaving and reccurring") - (values - calendars - (calculate-recurrence-set regular repeating)))) - -;; Basic version, loads calendrs, sorts the events, and returns -;; regular and repeating events separated from each other. -;; -;; (list string) → (list calendar), (list event), (list event) -(define* (load-calendars* #:optional (calendar-files (get-config 'calendar-files))) - - (define calendars (map parse-cal-path calendar-files)) - (define events (concatenate - ;; TODO does this drop events? - (map (lambda (cal) (filter (lambda (o) (eq? 'VEVENT (type o))) - (children cal))) - calendars))) - - (report-time! "Parse done, partitioning...") - (let* ((repeating regular (partition repeating? events))) - - (report-time! "Sorting") - ;; NOTE There might be instances where we don't care if the - ;; collection if sorted, but for the time beieng it's much - ;; easier to always sort it. - (values calendars - (sort*! regular date/-time