From d4f88c4a043ccb976e19f16d0568627689e8d679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 20 Mar 2019 21:42:00 +0100 Subject: Fix up fetch to use better abstractions. --- fetch.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'fetch.scm') diff --git a/fetch.scm b/fetch.scm index f134a850..a91e4d0d 100755 --- a/fetch.scm +++ b/fetch.scm @@ -10,26 +10,22 @@ (add-to-load-path (dirname (current-filename))) (use-modules (srfi srfi-1) - (srfi srfi-26) (srfi srfi-19) - (srfi srfi-19 util) + (srfi srfi-26) (vcalendar) + (vcalendar datetime) (vcalendar output) (util)) (begin - (define *path* "/home/hugo/.calendars/b85ba2e9-18aa-4451-91bb-b52da930e977/") + ;; (define *path* "/home/hugo/.calendars/b85ba2e9-18aa-4451-91bb-b52da930e977/") + (define *path* "/home/hugo/.calendars/D1/") (define cal (make-vcomponent *path*))) (filter-children! - (lambda (comp) - (if (not (eq? 'VEVENT (type comp))) - #t - (let ((stime (date->time-utc (string->date "2019-03-12T12:00" "~Y-~m-~dT~H:~M"))) - (etime (date->time-utc (string->date "2019-03-13T11:59" "~Y-~m-~dT~H:~M")))) - (and (time<=? stime (attr comp "DTSTART")) - (time<=? (attr comp "DTSTART") etime))))) + (lambda (ev) (and (eq? 'VEVENT (type ev)) + (event-in? ev (date->time-utc (string->date "2019-04-03" "~Y-~m-~d"))))) cal) (serialize-vcomponent cal) -- cgit v1.2.3