six tasks · real commands

Guides

upb-moodle guides: six ordinary tasks, each with the steps and the real commands. Pick the guide you need; each one also says what needs your confirmation.

Download a semester's materials

  1. Check the filters

    List the courses first, to see exactly what matches: --faculty accepts the number (04), the code (ETTI) or the name, and --program, --year, --sem, --series and --ay narrow the list.

    upb-moodle courses --faculty ETTI --year 2 --sem 1
  2. Download

    The download writes <Subject> (<Series>) folders, with the course sections as subfolders. --shallow takes only the structure and the files, without assignments, forums, quizzes and grades.

    upb-moodle download --year 2 --sem 1 --out D:\Materiale
  3. Run again if it stopped

    Files of the same size are skipped, so a repeated run does not download what is complete again. _rezumat.json in the root folder has the errors and warnings.

The download folder layout

Diagram: the `~/UPB-Moodle` folder holds one folder per course, named after the subject and series, with the course sections as subfolders; the course folder holds index.md, teme.md, forumuri/, quizuri.md, note.md, linkuri.txt and _raw/*.json.
One folder per course, with Markdown summaries and the raw data in _raw.

Diagram: the ~/UPB-Moodle folder holds one folder per course, named after the subject and series, with the course sections as subfolders; the course folder holds index.md, teme.md, forumuri/, quizuri.md, note.md, linkuri.txt and _raw/*.json.

See what you have to do this week

  1. Deadlines and notifications

    deadlines returns the next days' events, in order. notifications --unread shows only what you have not read, and the answer includes the unread count.

    upb-moodle deadlines --days 7
    upb-moodle notifications --unread
  2. In the agent

    The ready-made weekly_brief prompt does exactly this pass: deadlines, unread notifications and open assignments, without writing anything to Moodle.

Submit an assignment

  1. Read the requirement and the state

    assignment <id> says whether the assignment has drafts (drafts_enabled), what you already submitted, the grade and the feedback. The id appears in assignments.

    upb-moodle assignments
    upb-moodle assignment 201
  2. Save the draft, then submit

    Without --submit, the file stays a draft, if the assignment has drafts. With --submit, the submission is final. On an assignment without drafts, saving would submit immediately, so the package refuses; --allow-direct forces it, only at your explicit request.

    upb-moodle submit 201 referat.pdf --yes
    upb-moodle submit 201 referat.pdf --submit --yes

Reply on a forum

  1. Find the discussion

    forums lists the forums, forum <id> the discussions, and discussion <id> the posts, with text and attachments.

    upb-moodle forums --course 101
    upb-moodle forum 12
    upb-moodle discussion 34
  2. Write the reply

    reply needs --subject and the text from --text, --file or stdin. Without --yes, the command stops with code 2 and sends nothing.

    upb-moodle reply 34 --subject "Raspuns" --text "Textul" --yes

Answer a quiz

  1. Start the attempt

    quiz-start starts or resumes an attempt and counts against Moodle's limit. quiz-questions shows the questions, with the answer field name.

    upb-moodle quizzes --course 101
    upb-moodle quiz-start 7 --yes
    upb-moodle quiz-questions 30
  2. Save, then submit

    quiz-answer without --finish only saves. Submitting (--finish) is irreversible and needs a second approval. The field names must be copied exactly from quiz-questions.

    upb-moodle quiz-answer 30 --answers '{"q123:1_answer": "2"}' --yes
    upb-moodle quiz-answer 30 --answers '{"q123:1_answer": "2"}' --finish --yes

See the grades

  1. All courses or one

    grades without options returns every course's grades. With --course <id>, it returns the course's grade items: grades, ranges, percentages and feedback.

    upb-moodle grades
    upb-moodle grades --course 101