moodle-dowload.py is a small Python script to download a set of specifed files from the Moodle e-learning platform. You can create profiles (simple JSON files) that provide information on the courses and use regular expressions to determine which files should be downloaded and where they belong.
So far this has only been tested with the e-learning platform (v2.9) at University of Heidelberg. In principle, this could work for other Moodle platforms as well, but some modifications might be necessary.
If you want to check for new files and download them automatically, just set up a cron job or use a systemd service that runs moodle-download.py
periodically.
- Download or clone the repository from GitHub.
- Install the requirements:
sudo pip install -r requirements.txt
- Create necessary directories:
mkdir -p ~/.config/moodle-download/profiles
- Copy your configuration file to
~/.config/moodle-download/moodle-download.conf
(seemoodle-download.conf.example
for an example) - Put your profile files in
profiles/
(seeWS-2015-2016.example
for an example) - Optional: Set up a cron job or a systemd service.
All profile files must be valid JSON files. For every course you take, add a new dictionary to the profile. The key should be the course title (but doesn't really matter), id
is the Moodle course id (see URL of overview page), short
is a short description that will be used for symlinks, and downloads
lists the files to download. The first element is a regular expression that should match the files to download, second specifies the rename pattern and the third determines the download location.
Please install the following Python packages: docopt, mechanize, pgi. You can do that by running:
sudo pip install -r requirements.txt
GNU General Public License (GPLv3), see LICENSE.txt
for further details.