Repository navigation
Expand file tree
/
Copy pathstart-windows.bat
More file actions
60 lines (53 loc) · 2.16 KB
/
Copy pathstart-windows.bat
File metadata and controls
60 lines (53 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
rem muse2api Windows launcher: double-click to install deps and start locally. No server needed.
chcp 65001 >nul
cd /d "%~dp0"
rem Refuse to run elevated: Chrome re-spawns de-elevated and the debug port
rem never opens, so every generation would time out. Right-click run WITHOUT admin.
net session >nul 2>nul
if not errorlevel 1 (
echo [ERROR] This script is running as Administrator.
echo [ERROR] Chrome cannot stay attached to an elevated process: every request would fail.
echo [ERROR] Please re-run WITHOUT "Run as administrator" (plain double-click).
pause
exit /b 1
)
where python >nul 2>nul
if errorlevel 1 (
echo [ERROR] Python not found. Install Python 3.10+ from https://www.python.org/downloads/ and tick "Add python.exe to PATH".
pause
exit /b 1
)
if not exist ".env" (
copy ".env.example" ".env" >nul
echo [INFO] Created .env from .env.example. Edit MUSE2API_KEY if you want your own key.
)
echo [INFO] Installing dependencies (first run takes a while)...
python -m pip install -r requirements.txt
if errorlevel 1 (
echo [ERROR] pip install failed. Check your network and retry.
pause
exit /b 1
)
rem Load every key=value from .env into the shell environment.
rem This makes all MUSE2API_* settings available to Python via os.environ,
rem and lets the echo below show the correct host/port/key.
rem Lines starting with # and blank lines are ignored by FOR automatically.
for /f "usebackq tokens=1,* delims==" %%A in (".env") do (
echo(%%A| findstr /r "^[^#]" >nul 2>&1 && set "%%A=%%B"
)
rem Fallback defaults if .env left them empty
if "%MUSE2API_HOST%"=="" set MUSE2API_HOST=127.0.0.1
if "%MUSE2API_PORT%"=="" set MUSE2API_PORT=18610
echo.
echo [INFO] Starting muse2api at http://%MUSE2API_HOST%:%MUSE2API_PORT% ...
if "%MUSE2API_KEY%"=="" (
echo [INFO] Admin panel: http://%MUSE2API_HOST%:%MUSE2API_PORT%/ ^(key will be auto-generated and printed below as "m2a_..."^)
) else (
echo [INFO] Admin panel: http://%MUSE2API_HOST%:%MUSE2API_PORT%/?key=%MUSE2API_KEY%
)
echo [INFO] Chrome / Edge on this PC is auto-detected; MUSE2API_CHROMIUM in .env can stay empty.
echo [INFO] Keep this window open. Press Ctrl+C to stop.
echo.
python run.py
pause