Upload and share with ownCloud or NextCloud

Version 4 (Rémi G., 03/19/2018 10:56 am) → Version 5/20 (Rémi G., 03/19/2018 10:56 am)

h1. Presentation

"AMCtoOwncloud":https://github.com/remjg/AMCtoOwncloud is a _Nautilus script_ that sends Auto Multiple Choice (AMC) annotated papers to Owncloud/Nextcloud and share them with the corresponding students.

Each quiz file is uploaded to a remote folder unique to each student. Then each folder is:

* _shared with the student_ who can be a local user or a remote user on another federated server
* _shared by link_

Eventually, _shared links are saved_ to a newly created @.csv@ file (default behaviour) or to the current @.csv@ file.

In the end, the remote folder structure will look like this:

<pre>
Quizzes/
├── 3emeE/
| ├── MOUSE Mickey (3998) - Maths Quizzes/
│ │ └── Quiz 1 - MOUSE Mickey (3998).pdf
│ └── MOUSE Minnie (3999) - Maths Quizzes/
│ └── Quiz 1 - MOUSE Minnie (3999).pdf
└── 4emeE/
└── DUCK Donald (4999) - Maths Quizzes/
└── Quiz 1 - DUCK Donald (3999).pdf
</pre>

The root folder @Quizzes/@, @Quiz 1@, and @Maths Quizzes@ are configurable, and the other fields come from the `.csv` file.
I use this script to avoid sending emails.

h2. Installation

Download the "latest release from github":https://github.com/remjg/AMCtoOwncloud/releases/tag/v0.3.0 and copy @AMCtoOwncloud.sh@ and @.AMCtoOwncloud.py@ in the _Nautilus scripts_ folder: @~/.local/share/nautilus/scripts/@

!https://github.com/remjg/AMCtoOwncloud/raw/master/docs/InstallingScript.png!

In order to make it work, you need to install the following Python modules:

@requests@, @lxml.html@, @owncloud@ (see "pyocclient":https://github.com/owncloud/pyocclient).

Usually the first are packaged in your distribution. For the @owncloud@ package, I use the following command:

<pre>
pip3 install pyocclient
</pre>

You also need @gnome-terminal@ or you will have to edit the @AMCtoOwncloud.sh@ script file to use another terminal.

h3. Configuration

Edit the @.AMCtoOwncloud.py@ and change the parameters at the end:

<pre>
CSV = '/path/to/csv/students.csv'
FOLDER = 'Quizzes/'
ADDRESS = 'https://ncloud.zaclys.com'
USERNAME = 'MyUserName'
</pre>

The CSV file containing all your student information must use colons @:@ as separators and the following headers (there are optional parameters in method @identify_students()@ to change this behaviour, see at the end):

<pre>
group:surname:name:number:owncloud:email
3emeE:MOUSE:Mickey:3998:cabitzmil:mickeymouse@domain.com
3emeE:MOUSE:Minnie:3999:agrevet:minniemouse@domain.com
4emeE:DUCK:Donald:4999:prenaud@aFederatedServer.com:donaldduck@domain.com
</pre>