Generate CQU timetable iCalendar (ics) file
Project description
ICS 课程表文件生成脚本
适用于最新选课站点生成的 xlsx
格式的课表转换为日历软件能认到的 ICS
格式文件.
使用说明
使用 pip 安装依赖:
pip install .
直接运行 (demo)
准备从新选课网站下载的 课表.xlsx
或者 json 文件,放置于任意目录。
配置文件格式如下:
[config]
debug = False
base_dir = /home/ddqi/kb.xlsx
start_date = 20210301
file_name = timetable.ics
配置项 | 类型 | 示例 | 注释 |
---|---|---|---|
debug | boolean | True | 控制是否为调试模式,可选值:True False |
base_dir | str | /home/ddqi/kb.xlsx | 指向课表文件的路径 |
start_date | str | 20210301 | 行课日期 |
file_name | str | timetable.ics | 生成的 ics 文件名(为避免编码问题不要用中文),扩展名请勿更改,文件名不可包含中文 |
将配置文件 config.txt
放置在工作目录下,终端执行:
cqu_timetable_new
将生成指定文件名的 iCalendar 格式文件
tkinter 前端
使用 pip 安装依赖:
pip install .[tk]
之后可运行
cqu_timetable_new-tk
启动 tkinter 前端。
Qt5 前端
使用 pip 安装依赖:
pip install .[pyqt]
之后可运行
cqu_timetable_new-qt
启动 Qt5 前端。
作为库来使用
使用时需要先生成课表数据,再从课表数据中生成日历
-
生成课表数据
- 可通过
loadIO_from_json
或loadIO_from_xlsx
函数从文件或数据流中读取 json 或 xlsx,返回解析出的课表数据 - 也可通过
load_from_json
或load_from_xlsx
函数读取str
或bytes
格式的 json 或 xlsx 数据,返回解析出的课表数据
- 可通过
-
生成日历数据
使用
mkical
函数,第一个参数是上一步得到的课表数据,第二个参数是datetime.date
类型的开学日期,返回icalendar.Calendar
类型的日历数据,可通过其to_ical
得到 ics 文件的内容。
demo 可见于 main.py 中的 main
函数
FAQ
Q: 为什么不带有登录功能?
A: 因为我懒。如果你能做出带有登录功能的脚本请随意 pr 。我只信得过可以下载的自动生成的课表。
(主要还是依赖项少一些)
姊妹项目
cm-http-api (开发中)
LICENSES
AGPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cqu_timetable_new-0.3.2.10.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddf0af44fdd4ebf3ff6e0821db16620c97c8d15c98acac4e031563ff434469ca |
|
MD5 | 8bb39dbd289aecbf6d7f3b6333699f6d |
|
BLAKE2b-256 | f9d9594d3c806e1cdd869fd1c5b28067c795677109cb102c267dc744c7ba780e |
Close
Hashes for cqu_timetable_new-0.3.2.10.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e506370d1e61bf98899a41d6790c6bbcdc9c37989e1c03f25061e142b5060d17 |
|
MD5 | 1c6e35c7003a55bf26a0d67a50a3adaf |
|
BLAKE2b-256 | 34b9e2ecd868099c935d874b2fa7b7727faa204d104b5fb7be38ccc29b0c1a55 |