diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-03-11 00:10:48 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-03-11 00:10:48 +0100 |
commit | 572af695323f54e49ab4b66e904abb3c5d0daac4 (patch) | |
tree | 51da4fe8212c2f8f65a7ba5a02b8da9153614ab5 | |
parent | Add ctags generation for RFC-file. (diff) | |
download | calp-572af695323f54e49ab4b66e904abb3c5d0daac4.tar.gz calp-572af695323f54e49ab4b66e904abb3c5d0daac4.tar.xz |
Add sample fetch.scm.
-rwxr-xr-x | fetch.scm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fetch.scm b/fetch.scm new file mode 100755 index 00000000..f134a850 --- /dev/null +++ b/fetch.scm @@ -0,0 +1,35 @@ +#!/usr/bin/guile -s +!# + +#| + | Example file which reads my regular calendar, filters it down to only + | the events between specific times, and prints that calendar in ICS + | format to standard output. + |# + +(add-to-load-path (dirname (current-filename))) + +(use-modules (srfi srfi-1) + (srfi srfi-26) + (srfi srfi-19) + (srfi srfi-19 util) + (vcalendar) + (vcalendar output) + (util)) + + +(begin + (define *path* "/home/hugo/.calendars/b85ba2e9-18aa-4451-91bb-b52da930e977/") + (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))))) + cal) + +(serialize-vcomponent cal) |