TUM moodle downloader - a command-line tool that keeps local copies of your TUM Moodle courses up to date.
- logs in like a browser, without one: TUM ID and password, plus the one-time code from your authenticator app if your account uses two-factor login, straight from the terminal. your password goes into the system keychain, and the session is reused until it expires.
- syncs without losing anything: new files are added and changed files are updated. a file you edited is never overwritten; Moodle's newer version is saved next to it as
name (moodle).ext. nothing is ever deleted. - downloads each course through its Moodle Download Center, the same zip you get from the button on the course page.
uv tool install git+https://github.com/Intex32/tum-moodle-dltmdl login # asks for your TUM ID, password and, with two-factor login, a code
tmdl courses # lists your current courses (--all: past and future too)
tmdl courses add 12345 analysis # syncs these courses from now on: an ID or part of the name
tmdl courses remove analysis # stops syncing a course; its folder stays
tmdl sync # downloads new and changed files of the courses you added
tmdl sync 12345 # syncs one course, added or not
tmdl logout # --forget also removes your login details from the keychaintmdl courses add also changes a course's settings: --dir sets its folder, and --original-filenames / --activity-names choose how files are named.
tmdl courses add/remove keep ~/.config/tum-moodle-dl/config.toml up to date (or the file given with --config / TMDL_CONFIG). you can also edit it by hand; tmdl keeps your comments.
root = "~/Moodle" # where course folders go (default: ~/Moodle)
original_filenames = false # name files as uploaded, not after the activity (default: false)
[[courses]]
id = 12345
dir = "analysis" # optional: folder, relative to root (default: the course's short name)
original_filenames = true # optional: per-course settingwhen the session has expired, tmdl sync logs in again by itself. without two-factor login that needs nothing more; with it, it needs a one-time code. to run it from cron, store your authenticator's secret (the text behind the QR code you scan when setting up an authenticator app, or the otpauth:// link):
tmdl login --totp-secretthis keeps your password and your second factor on the same machine, so only do it on a machine you trust.
- login stops at an unexpected page:
tmdl login --debugsaves every login page (secrets removed) to~/.local/state/tum-moodle-dl/debug/. - you only use a passkey: tmdl needs an authenticator app as your second factor; add one to your TUM account.
- coming from the old Selenium version: add your courses with
tmdl courses addand deleteconfig.json, since it holds your password in plain text. thereplaceupdate policy is gone: sync never deletes files.
uses devenv: it provides Python and uv, and keeps the dependencies in sync.
devenv shell
devenv shell -- pytest
devenv shell -- tmdl --help