Automated course material synchronization for AAST Moodle LMS
Eliminates the manual effort of downloading and organizing lectures, sections, and assignments from the AAST LMS. Supports delta sync, intelligent categorization, Google Drive integration, and AI agent control via the Gemini CLI.
- Features
- Architecture
- Prerequisites
- Setup
- Configuration
- Usage
- AI Skill Integration
- Security & Privacy
- License
| Feature | Description |
|---|---|
| Automated Sync | Pulls course materials directly from the AAST LMS (Moodle) |
| Course Discovery | Auto-detects enrolled courses and their LMS IDs |
| Smart Categorization | Sorts resources into Lectures/, Sections/, and Assignments/ |
| Standardized Naming | Applies Week XX β [Resource Name] prefix from LMS section structure |
| Delta Sync | Only downloads new or modified files β saves time and bandwidth |
| Google Drive Support | Syncs supplementary materials from Drive links via gdown |
| Session Persistence | Caches authenticated sessions to minimize login frequency |
aast-lms-sync/
βββ scripts/
β βββ discover.cjs # Dashboard scraper β extracts course names & LMS IDs
β βββ lms_sync.cjs # Core sync engine β auth, parsing, download pipeline
β βββ parse_portal.cjs # AAST portal utilities & data extraction
βββ courses.json # Course ID mapping (created from example)
βββ courses.json.example # Template for courses.json
βββ SKILL.md # AI agent skill definition (Gemini / MCP)
βββ package.json
Credentials βββΊ Authentication βββΊ Session Cache (session.json)
β
βΌ
Course ID Resolution
(courses.json / Discovery)
β
βΌ
Delta Analysis
(remote metadata vs local state)
β
ββββββββββ΄βββββββββ
βΌ βΌ
LMS Download Google Drive
(axios/fetch) (gdown)
β β
ββββββββββ¬βββββββββ
βΌ
Post-Processing
(rename β Week XX prefix β categorize)
| Dependency | Version | Purpose |
|---|---|---|
| Node.js | v16+ | Runtime environment |
| Puppeteer | bundled via npm | Headless browser for Moodle login & AJAX pages |
| gdown | latest | Downloads files/folders from Google Drive |
| Chrome / Chromium | any recent | Browser engine used by Puppeteer |
Install gdown via pip:
pip install gdowngit clone https://github.com/4awmy/aast-lms-sync.git
cd aast-lms-sync
npm installCreate lms_creds.txt in your Uni directory:
your_lms_username
your_lms_password
Important
Each credential must be on its own line. Do not include labels or extra whitespace.
Create a .env file in the project root:
BASE_DIR="C:/Users/YourUser/OneDrive/Desktop/Uni"
CRED_FILE="C:/Users/YourUser/OneDrive/Desktop/Uni/lms_creds.txt"
GDOWN_PATH="gdown"
PUPPETEER_EXECUTABLE_PATH="C:/Program Files/Google/Chrome/Application/chrome.exe"Copy the example and populate your courses:
cp courses.json.example courses.jsonEdit courses.json:
{
"Numerical Methods": { "id": "1523" },
"System Modeling And Simulation": {
"id": "10227",
"extra_sources": {
"Sections": "https://drive.google.com/drive/folders/YOUR_FOLDER_ID"
}
},
"Computing Algorithms": { "id": "10230" }
}Tip: Don't know your course IDs? Run the discovery script:
npm run discover
node scripts/lms_sync.cjs "Numerical Methods"npm run discoverAfter a sync, materials are organized as:
Uni/
βββ Numerical Methods/
βββ Lectures/
β βββ Week 01 β Introduction to Numerical Methods.pdf
β βββ Week 02 β Error Analysis.pdf
βββ Sections/
β βββ Week 01 β Section Practice.pdf
βββ Assignments/
βββ Week 03 β Assignment 1.pdf
aast-lms-sync is designed as an AI Skill compatible with the Gemini CLI and MCP-based agents. The SKILL.md file provides agents with the context to:
- Understand when to trigger a sync
- Map natural language course names to script parameters
- Handle local filesystem paths according to the user's workspace
"Sync my Computing Algorithms course."
"Check for new assignments in Numerical Methods."
"Download all missing materials for this week."
Caution
Protect Your Credentials
lms_creds.txtβ Contains your plaintext LMS password. Store it in a secure location and never commit it to version control. It is listed in.gitignoreby default.session.jsonβ Contains active session cookies. Treat it with the same security level as your password..envβ Contains filesystem paths. Do not commit.
Compliance: Use this tool in accordance with AAST's Acceptable Use Policy. Avoid excessive scraping that may trigger rate limits or security flags.
This project is licensed under the ISC License.