Skip to content

Manage Study Resources on "Resources" Page

wolfishLamb edited this page Jun 27, 2024 · 1 revision

The study resources are organised in the data/resources.yml. It should look something like this:

- section_name: ...
  groups:
    - group_name: ...
      folder_link: https://drive.google.com/drive/folders/<folder-id>?usp=sharing
      file_ids:
        - <file-id-1>
        - <file-id-2>

A "section" corresponds to a navigation tab in the "Resource" page. A "file ID" is the ID in the Google Drive file link, 33 characters long.

Download thumbnails

Run spider.py, it will process the file above and download thumbnails to static/resources by requesting Google's API.

A file, data/_resources_mapping.yml, is also created. It contains the mappings of file IDs to filenames. You shouldn't modify this file, as it will be overwritten by the script in the next run.

Potential Errors and Considerations

For some files, especially large files, Google Drive might not provide pre-generated thumbnails. In such cases, the script will attempt to download the WHOLE file and generate its thumbnail locally. However, doing this too frequently may get you a temporary ban from Google. You should adjust the code accordingly to maintain an adequate request rate.

The TIA tech committee members are called upon to collaborate with the Resources Department, organising the Google Drive and study resources on the TIA's website collectively.