Upload and share with ownCloud or NextCloud

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

1 4 Rémi G.
h1. Presentation
2 1
3 1
"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.
4 1
5 1
Each quiz file is uploaded to a remote folder unique to each student. Then each folder is:
6 1
7 3 Rémi G.
* _shared with the student_ who can be a local user or a remote user on another federated server
8 3 Rémi G.
* _shared by link_
9 1
10 3 Rémi G.
Eventually, _shared links are saved_ to a newly created @.csv@ file (default behaviour) or to the current @.csv@ file.
11 1
12 1
In the end, the remote folder structure will look like this:
13 1
14 1
<pre>
15 1
Quizzes/
16 1
├── 3emeE/
17 1
|   ├── MOUSE Mickey (3998) - Maths Quizzes/
18 1
│   │   └── Quiz 1 - MOUSE Mickey (3998).pdf
19 1
│   └── MOUSE Minnie (3999) - Maths Quizzes/
20 1
│       └── Quiz 1 - MOUSE Minnie (3999).pdf
21 1
└── 4emeE/
22 1
    └── DUCK Donald (4999) - Maths Quizzes/
23 1
        └── Quiz 1 - DUCK Donald (3999).pdf
24 1
</pre>
25 1
26 1
The root folder @Quizzes/@, @Quiz 1@, and @Maths Quizzes@ are configurable, and the other fields come from the `.csv` file.
27 1
I use this script to avoid sending emails.
28 4 Rémi G.
29 4 Rémi G.
h2. Installation
30 4 Rémi G.
31 4 Rémi G.
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/@
32 4 Rémi G.
33 4 Rémi G.
!https://github.com/remjg/AMCtoOwncloud/raw/master/docs/InstallingScript.png!
34 5 Rémi G.
35 5 Rémi G.
In order to make it work, you need to install the following Python modules:
36 5 Rémi G.
37 5 Rémi G.
@requests@, @lxml.html@, @owncloud@ (see "pyocclient":https://github.com/owncloud/pyocclient).
38 5 Rémi G.
39 5 Rémi G.
Usually the first are packaged in your distribution. For the @owncloud@ package, I use the following command:
40 5 Rémi G.
41 5 Rémi G.
<pre>
42 5 Rémi G.
pip3 install pyocclient
43 5 Rémi G.
</pre>
44 5 Rémi G.
45 5 Rémi G.
You also need @gnome-terminal@ or you will have to edit the @AMCtoOwncloud.sh@ script file to use another terminal.
46 5 Rémi G.
47 5 Rémi G.
h3. Configuration
48 5 Rémi G.
49 5 Rémi G.
Edit the @.AMCtoOwncloud.py@ and change the parameters at the end:
50 5 Rémi G.
51 5 Rémi G.
<pre> 
52 5 Rémi G.
CSV = '/path/to/csv/students.csv'
53 5 Rémi G.
FOLDER = 'Quizzes/'
54 5 Rémi G.
ADDRESS = 'https://ncloud.zaclys.com'
55 5 Rémi G.
USERNAME = 'MyUserName'
56 5 Rémi G.
</pre>
57 5 Rémi G.
58 5 Rémi G.
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):
59 5 Rémi G.
60 5 Rémi G.
<pre>
61 5 Rémi G.
group:surname:name:number:owncloud:email
62 5 Rémi G.
3emeE:MOUSE:Mickey:3998:cabitzmil:mickeymouse@domain.com
63 5 Rémi G.
3emeE:MOUSE:Minnie:3999:agrevet:minniemouse@domain.com
64 5 Rémi G.
4emeE:DUCK:Donald:4999:prenaud@aFederatedServer.com:donaldduck@domain.com
65 5 Rémi G.
</pre>