1 #+OPTIONS: H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
5 #+TITLE: Connecting your Org files with Owncloud
6 #+AUTHOR: Giménez, Christian Nelson
12 [[file:index.org][{Back to Worg's index}]]
14 * TODO Fast and simple
15 This section is for people in a hurry.
17 * Downloading from Owncloud
18 Here I will explain how to download the ICS files and translate it into Org file
21 Using WGet or Curl at the following URL:
23 https://the-server-site.com/owncloud/remote.php/caldav/calendars/USERNAME/CALENDAR-NAME
25 Take a look at the [[*sync-download.sh][sync-download script]].
27 ** Translating ICalendar to Org
28 Using ics2org AWK script into the directory pointed by the ~org-directory~ variable or some other place.
30 You may need to tune this (for example, ~max_age= -1;~ instead the default value).
32 Take a look at the [[*sync-download.sh][sync-download script]].
34 There's a [[*ics2org%20-%20modified%20version][modified version]] that you can use for distinguish between past jobs and futures by translating differents TODO states.
36 ** Integrating everything
38 We must create a simple script for calling the [[*sync-download.sh][sync-download script]] with all the required information. This will be necessary for adding into the cron process and updating for every 15 or more minutes.
40 This script must be edited with your username, password, the location of the sync-download script and the url needed.
42 You may like to add more actions like moving or copying the file into your own org directory.
44 You can use the [[*integration%20script%20for%20downloading][integration script]] as a model.
48 Tell cron to execute the [[*integration%20script%20for%20downloading][integration bash script]] every 15 minutes or more:
52 Add the following line:
54 : */15 * * * * $HOME/path-to-script/sync-owncloud.sh
56 Save and check with ~crontab -l~.
58 * Uploading to Owncloud
60 CalDav stores all the ICalendar files into a directory, there you can change and manipulate everything you need.
62 Usually the URL is https://the-server-site.com/owncloud/remote.php/caldav/calendars/USERNAME/CALENDAR-NAME
64 ** Export using the org-export command
65 *** Some Variables First
66 ~org-icalendars~ needs some variables sets before starting, and you have to test that the exporting goes well.
68 This are the variable needed:
70 - ~org-icalendar-include-todo~ :: You must set this to ~t~ if you want the TODOs entries exported.
71 - ~org-icalendar-store-UID~ :: This is needed for exporting the same VEVENT/VTODO and don't create duplicates entries into the calendars.
73 You can set this variables using the "file-local variables" feature (use ~M-x add-file-local-variable~ or ~M-x add-file-local-variable-prop-line~) or pasting this at the end of your org file
77 # org-icalendar-include-todo: t
78 # org-icalendar-store-UID: t
82 Open your org file and press ~C-c C-e i~ for exporting the current file, or use the ~org-export-icalendar-this-file~ interactive function.
84 *** Importing with Kontact
85 Kontact, the KDE personal information manager, can import ICS and combine it with the current calendar. If you have configured the program to sync with owncloud, you can use this for manual importing.
88 Remember that Emacs can execute elisp scripts for terminal with one of these parameters:
90 - ~--eval~ to eval an expresino given by parameter.
91 - ~--load~ to load a file.
92 - ~--script~ to run a file as an emacs script.
93 ** Correcting the ICS file
94 Owncloud doesn't accept a lot of things:
96 - Owncloud don't know what a VTODO is.
97 - DUE neither, it should be changed into DTEND
98 - DTSTART is exported by org into the actual date and time, it should be changed to the same of the DUE(DTEND) date. It cannot be ignored or deleted.
100 The [[*correct-ical.awk][correct-ical.awk]] script can be used for solve all these problems automatically.
102 ** Spliting the ICS file
104 Owncloud only accepts ICS files with only one event inside. The script [[*split-ics.awk][split-ics.awk]] can be used for this purpose: it separates each event into a new file.
105 ** Renaming ICS files
106 Each file has to have its own name, and what is a better choice than the UID of each event?
110 Using ~cadaver~ you can upload and download files. You need to upload the ics file into the server by the "PUT" HTTP request.
112 Remember to set the username and password writing it at the .cadaverrc file.
116 Using the sync-pull-owncloud
122 ** ics2org - modified version
129 ** integration script for downloading