Update some changed export keybindings
[worg.git] / org-tutorials / org-owncloud.org
blob8d2b2d27ded03d04e0377227ff255014ab113e4e
1 #+TITLE:      Connecting your Org files with Owncloud
2 #+AUTHOR:     Giménez, Christian Nelson
3 #+EMAIL:      
4 #+OPTIONS:    H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
5 #+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate
6 #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
7 #+TAGS:       Write(w) Update(u) Fix(f) Check(c) 
8 #+LANGUAGE:   en
9 #+PRIORITIES: A C B
10 #+CATEGORY:   worg
12 # This file is released by its authors and contributors under the GNU
13 # Free Documentation license v1.3 or later, code examples are released
14 # under the GNU General Public License v3 or later.
16 [[file:index.org][{Back to Worg's index}]]
18 * TODO Fast and simple
19   This section is for people in a hurry. 
21 * Downloading from Owncloud
22 Here I will explain how to download the ICS files and translate it into Org file
24 ** Downloading 
25    Using WGet or Curl at the following URL:
27    https://the-server-site.com/owncloud/remote.php/caldav/calendars/USERNAME/CALENDAR-NAME
29    Take a look at the [[*sync-download.sh][sync-download script]].
30    
31 ** Translating ICalendar to Org
32    Using ics2org AWK script into the directory pointed by the ~org-directory~ variable or some other place.
33    
34    You may need to tune this (for example, ~max_age= -1;~ instead the default value). 
36    Take a look at the [[*sync-download.sh][sync-download script]].
38    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.
40 ** Integrating everything
41    
42    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.
44    This script must be edited with your username, password, the location of the sync-download script and the url needed.
46    You may like to add more actions like moving or copying the file into your own org directory.
48    You can use the [[*integration%20script%20for%20downloading][integration script]] as a model.
49    
50 ** Cron
51    
52    Tell cron to execute the [[*integration%20script%20for%20downloading][integration bash script]] every 15 minutes or more: 
53    
54    : crontab -e 
55    
56    Add the following line:
58    : */15 * * * * $HOME/path-to-script/sync-owncloud.sh
59    
60    Save and check with ~crontab -l~.
62 * Uploading to Owncloud
63 ** Basics Concepts
64    CalDav stores all the ICalendar files into a directory, there you can change and manipulate everything you need.
66    Usually the URL is https://the-server-site.com/owncloud/remote.php/caldav/calendars/USERNAME/CALENDAR-NAME
68 ** Export using the org-export command
69 *** Some Variables First
70    ~org-icalendars~ needs some variables sets before starting, and you have to test that the exporting goes well.
72    This are the variable needed: 
73    
74    - ~org-icalendar-include-todo~ :: You must set this to ~t~ if you want the TODOs entries exported.
75    - ~org-icalendar-store-UID~ :: This is needed for exporting the same VEVENT/VTODO and don't create duplicates entries into the calendars.
77    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
79 #+BEGIN_SRC: org
80 # Local Variables:
81 # org-icalendar-include-todo: t
82 # org-icalendar-store-UID: t
83 # End:
84 #+END_SRC
85 *** Exporting
86     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.
88 *** Importing with Kontact
89     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. 
91 *** From the Terminal
92     Remember that Emacs can execute elisp scripts for terminal with one of these parameters:
93     
94     - ~--eval~ to eval an expresino given by parameter.
95     - ~--load~ to load a file.
96     - ~--script~ to run a file as an emacs script.
97 ** Correcting the ICS file
98    Owncloud doesn't accept a lot of things:
100    - Owncloud don't know what a VTODO is.
101    - DUE neither, it should be changed into DTEND
102    - 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.
104    The [[*correct-ical.awk][correct-ical.awk]] script can be used for solve all these problems automatically.
105      
106 ** Spliting the ICS file
107    
108    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.
109 ** Renaming ICS files
110    Each file has to have its own name, and what is a better choice than the UID of each event?
111    
112 ** Uploading files
113    
114    Using ~cadaver~ you can upload and download files. You need to upload the ics file into the server by the "PUT" HTTP request.
116    Remember to set the username and password writing it at the .cadaverrc file.
118 ** Automatic
119    
120    Using the sync-pull-owncloud
122 * Scripts needed
124 ** sync-download.sh
125    
126 ** ics2org - modified version
129 ** correct-ical.awk
131 ** split-ics.awk
133 ** integration script for downloading