maxCourses 按整门课计数,而积分按课时计;只剩考试的课会白占名额, 曾出现 5 门用光但今日视频积分只拿到 1/3 就停止的情况。现在只由 今日积分完成、没有可学内容或 budgetMinutes 决定收尾。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.7 KiB
Batchfile
61 lines
1.7 KiB
Batchfile
@echo off
|
|
rem ---------------------------------------------------------------
|
|
rem This file must stay PURE ASCII.
|
|
rem cmd.exe reads batch files byte-by-byte with the current code page;
|
|
rem multi-byte characters (e.g. Chinese) corrupt line offsets and make
|
|
rem it report nonsense like "'npm' is not recognized".
|
|
rem All Chinese messages come from the Node runner output instead.
|
|
rem
|
|
rem Usage:
|
|
rem scripts\start-headless.cmd use config\runner.config.mjs
|
|
rem scripts\start-headless.cmd --help print all options
|
|
rem scripts\start-headless.cmd --budget-minutes 15 command line overrides config file
|
|
rem ---------------------------------------------------------------
|
|
setlocal
|
|
chcp 65001 >nul
|
|
cd /d "%~dp0.."
|
|
title YunXueTang Assistant - headless runner
|
|
|
|
where node >nul 2>nul
|
|
if errorlevel 1 goto no_node
|
|
|
|
if exist "yun-xue-tang-assistant.user.js" goto have_build
|
|
echo [build] build output not found, running npm run build ...
|
|
call npm run build
|
|
if errorlevel 1 goto build_fail
|
|
|
|
:have_build
|
|
if not exist "config\runner.config.mjs" goto no_config
|
|
echo [config] config\runner.config.mjs found, editing it is enough (no rebuild needed)
|
|
goto run
|
|
|
|
:no_config
|
|
echo [warn] config\runner.config.mjs not found, built-in defaults will be used
|
|
|
|
:run
|
|
echo [run] headless runner starting, press Ctrl+C to stop
|
|
echo.
|
|
node "runner/headless.mjs" %*
|
|
set RC=%ERRORLEVEL%
|
|
|
|
if "%RC%"=="0" goto done
|
|
echo.
|
|
echo [exit] code %RC%
|
|
echo 0 finished 1 no progress 2 env/args error 3 login failed
|
|
echo full log: run-logs\headless.log
|
|
pause
|
|
exit /b %RC%
|
|
|
|
:done
|
|
exit /b 0
|
|
|
|
:no_node
|
|
echo [error] node.exe not found. Install Node.js 22+ from https://nodejs.org/
|
|
pause
|
|
exit /b 1
|
|
|
|
:build_fail
|
|
echo [error] build failed. Run npm install first.
|
|
pause
|
|
exit /b 1
|