orgzly-revived / orgzly-android-revived

Outliner for taking notes and managing to-do lists
https://www.orgzlyrevived.com
GNU General Public License v3.0
624 stars 39 forks source link

Export search results as .ics #38

Open alensiljak opened 12 months ago

alensiljak commented 12 months ago

Original request: https://github.com/orgzly/orgzly-android/issues/946

The purpose of this request is summarized in this comment:

If relying on ICSx5, all that would be needed for this functionality is an ICS export in the search results (i.e. Agenda).

hrdl-github commented 6 months ago

ox-icalendar.el (https://github.com/emacs-mirror/emacs/blob/master/lisp/org/ox-icalendar.el) is an excellent reference. I haven't used VTODO components yet, but other features like VALARM work out-of-the-box.

Just for reference, as this approach has been serving me well: I use

(setq org-icalendar-combined-agenda-file "~/org/sync/org-journal.ics")
(defun hrdl/org-journal-calendar-export ()
  "Call `org-icalendar-combine-agenda-files' and upload to WebDAV server."
  (org-icalendar-combine-agenda-files)
  (start-process  "sync-org-ics" "sync-org-ics" "sync-org-ics"))
(advice-add 'org-journal-after-save-hook :after #'hrdl/org-journal-calendar-export)

and upload this using sync-org-ics:

URL="https://$MACHINE/$LOGIN/$RESOURCE/"
PASSWORD="$(secret-tool lookup $LOGIN password)"
FILEPATH=~/org/sync/org-journal.ics

resp=$(curl --netrc-file <(cat <<<"machine $MACHINE login $LOGIN password $PASSWORD") \
  -X PUT --data-binary "@$FILEPATH" "$URL")

if [[ ! -z $resp ]]; then 
  notify-send "sync-org-ics-failed" "$resp"
fi