Giter VIP home page Giter VIP logo

ucas_scoreupdatemonitor's Introduction

Score Update Monitor

  • **科学院大学本科成绩/绩点更新检测脚本,定时检测成绩/绩点更新并发送提醒。
  • 测试环境为python 3.9,不确定其它环境是否支持。
  • Windows下已提供一键部署的Release,无需python环境即可使用。

程序配置

  • 所有平台都具有的基本文件结构及基本配置过程如下:

    1. 打开./config/userInfo.json文件,在userName字段填入登陆SEP的用户名,在password字段填入登陆SEP的密码;

      • 这两个字段用于模拟登陆;
    2. 首次使用/若上次登陆sep时使用的浏览器与之前使用的浏览器不同/手动登陆sep时出现了重新认证提示,请打开./config/config.json文件,修改User-Agent字段为最新的浏览器User-Agent。并使用浏览器先完成认证后再使用。

      • 附获取浏览器User-Agent的方法:在浏览器地址栏输入about:version,打开的页面中的用户代理,或User-Agent,或UA即为所需User-Agent。
    3. (选做)为了实现成绩/绩点更新时发送提醒功能,使用了Server酱提供的微信提醒API,用户需要扫码登陆后在Key&API界面复制SendKey,并填写到./config/userInfo.json文件的apikey字段;

      • 若不填写apikey字段,则不会收到成绩/绩点更新的提醒,用户可以在./log/log.txt中查看更新情况;

      • 该API截止目前(2023/07/23)每天都有免费的发送额度,正常情况下不会给用户造成任何支出;

      • 后续考虑推出邮件提醒方式和短信提醒方式,但是考虑到配置邮件服务器的过程可能较为复杂,短信发送平台成本较高,还是推荐使用微信提醒API;

    .
    │
    ├─assets
    │      favicon.ico
    │
    ├─config
    │      userInfo.json
    │      config.json
    │
    ├─log
    │      log.txt
    │
    ├─module
    │      charsets.json
    │      sep.onnx
    │
    └─tmp
            cur_score.json
    
  • 注意:./conifg/config.json中可以配置各个过程的url,若查询接口变化可以通过该文件进行配置。

  • 接着根据平台不同继续进行配置:

Windows

  • Releases中提供了exe文件,无需配置python环境即可使用。

  • 文件结构及配置过程如下

    1. 右键config.ps1,选择使用 PowerShell 运行config.ps1会根据当前路径配置UCASScoreUpdateMonitor.xml文件;

      • 若该步骤运行失败可以直接打开UCASScoreUpdateMonitor.xml文件并将文件中__command_file__处替换为ScoreUpdateMonitor.bat文件的绝对路径,将__working_dir__处替换为ScoreUpdateMonitor.bat文件所在的文件夹的绝对路径;
    2. 右键reg.bat选择以管理员身份运行reg.bat会自动将检测更新程序注册为任务计划程序,并在用户每次解锁电脑时触发,之后间隔一天触发一次,若中途有解锁则会刷新间隔;

      • 若该步骤失败可以打开Windows的任务计划程序,选择导入任务,通过UCASScoreUpdateMonitor.xml文件导入任务;
      • 导入成功后会产生名为UCASScoreUpdateMonitor的任务,用户可以根据自己的需要自行定义任务触发的事件,每次任务触发即为检测一次更新;
    3. 按照所有平台基本配置过程设置自己的User-Agent

    • 至此,程序的配置完成。
    .
    │  config.ps1
    │  README.md
    │  reg.bat
    │  ScoreUpdateMonitor.bat
    │  ScoreUpdateMonitor.exe
    │  UCASScoreUpdateMonitor.xml
    │
    ├─assets
    │      favicon.ico
    │
    ├─config
    │      userInfo.json
    │      config.json
    │
    ├─log
    │      log.txt
    │
    ├─module
    │      charsets.json
    │      sep.onnx
    │
    └─tmp
            cur_score.json
    

Linux

  • 目前唯一的方法是安装依赖并定时运行main.py

    • 使用下列方法安装依赖:

      python -m pip install -r requirements.txt
    • Linux下设置定时运行的方式请自行搜索

  • 文件结构如下

    .
    │  main.py
    │  README.md
    │
    ├─assets
    │      favicon.ico
    │
    ├─config
    │      userInfo.json
    │      config.json
    │
    ├─log
    │      log.txt
    │
    ├─module
    │      charsets.json
    │      sep.onnx
    │
    ├─src
    │      score_update_logger.py
    │      score_update_monitor.py
    │
    └─tmp
            cur_score.json
    

MAC

  • 与Linux类似。

运行输出

  • 若配置了apikey

    • 当检测到成绩更新时,会将成绩更新后SEP上显示的绩点及排名以及更新的科目与对应成绩发送到API的公众号上,标题为Score Update Monitor: Score Update

    • 当检测到绩点更新时,会将SEP上更新后的绩点及排名发送到API的公众号上,标题为Score Update Monitor: GPA Update

    • 当检测出现错误时,会将报错信息发送到API的公众号上,标题为Score Update Monitor: Error;

  • 运行时产生的日志在./log/log.txt中;

TODO

  • 实现邮件通知和短信通知
  • 实现Linux一键配置
  • 实现MAC一键配置
  • 使用github action实现打包和预发布
  • ...

问题反馈

  • 在使用中遇到问题,请提交Issue

更新

  • 2023/07/23:增加实时GPA计算
  • 2023/07/23:修复中期退课的课程分数为空,在计算GPA时引发异常的bug
  • 2024/07/20:更新相关接口,修复SEP新增的新设备登陆认证导致的模拟登陆失败问题

ucas_scoreupdatemonitor's People

Contributors

ljs-2002 avatar

Stargazers

 avatar yc l avatar Chavapa avatar  avatar  avatar Keria Tang avatar xu_zh avatar

Watchers

 avatar

Forkers

codingboylink

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.