aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-22 18:17:11 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-22 18:24:14 +0200
commitbebf7e80fc3d9324462119def8e3df832b115f12 (patch)
tree4a8fbb1fb14b96dcb058b7bccb11d42b047a5e52
parentFilter X-HNH-FILENAME from ical output. (diff)
downloadcalp-bebf7e80fc3d9324462119def8e3df832b115f12.tar.gz
calp-bebf7e80fc3d9324462119def8e3df832b115f12.tar.xz
ICAL Change to new tz source.
-rw-r--r--module/output/ical.scm29
1 files changed, 22 insertions, 7 deletions
diff --git a/module/output/ical.scm b/module/output/ical.scm
index 9190a9bb..c8adbb59 100644
--- a/module/output/ical.scm
+++ b/module/output/ical.scm
@@ -146,13 +146,28 @@ CALSCALE:GREGORIAN\r
(define-public (ical-main calendars regular-events repeating-events start end)
(print-header)
- (let ((tzs (make-hash-table)))
- (for cal in calendars
- (for tz in (filter (lambda (e) (eq? 'VTIMEZONE (type e))) (children cal))
- (hash-set! tzs (attr tz 'TZID) tz)))
-
- (hash-for-each (lambda (key component) (component->ical-string component))
- tzs))
+ (let ((zoneinfo
+ (apply read-zoneinfo
+ ;; TODO move this to config, and figure out
+ ;; how to best acquire/bundle zoneinfo.
+ ((@ (glob) glob) "~/down/tz/{africa,antartica,asia,australasia,europe,northamerica,southamerica,backward}")))
+ (tz-names
+ (lset-difference
+ equal? (lset-union
+ equal? '("dummy")
+ (concatenate
+ (map (lambda (cal)
+ (filter-map
+ (lambda (vline)
+ (and=> (prop vline 'TZID) car))
+ (filter-map (extract* 'DTSTART)
+ (children cal))))
+ calendars)))
+ '("dummy" "local"))))
+ (for-each
+ component->ical-string
+ (map (lambda (name) (zoneinfo->vtimezone zoneinfo name))
+ tz-names)))
;; TODO add support for running without a range limiter, emiting all objects.
(for-each