-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
134 lines (125 loc) · 5.16 KB
/
Copy pathinstall.bat
File metadata and controls
134 lines (125 loc) · 5.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@echo off
setlocal enabledelayedexpansion
title DCS ATC Bot — Installer
echo ============================================================
echo DCS ATC Bot — Windows Installer
echo ============================================================
echo.
:: --- Check Python ----------------------------------------------------------
python --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python not found. Install Python 3.11+ from https://python.org
pause & exit /b 1
)
for /f "tokens=2" %%v in ('python --version 2^>^&1') do set PYVER=%%v
echo [OK] Python %PYVER% found.
:: --- Install Python deps ---------------------------------------------------
echo.
echo [1/4] Installing Python dependencies...
pip install -r requirements.txt
if errorlevel 1 ( echo [ERROR] pip install failed. & pause & exit /b 1 )
echo [OK] Python dependencies installed.
:: --- Download Piper --------------------------------------------------------
echo.
echo [2/4] Setting up Piper TTS...
if exist "piper\piper.exe" (
echo [OK] Piper already installed, skipping.
) else (
set PIPER_URL=https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_windows_amd64.zip
set PIPER_ZIP=%TEMP%\piper_windows_amd64.zip
echo Downloading Piper...
powershell -Command "Invoke-WebRequest -Uri '!PIPER_URL!' -OutFile '!PIPER_ZIP!' -UseBasicParsing"
if errorlevel 1 ( echo [ERROR] Failed to download Piper. & pause & exit /b 1 )
echo Extracting Piper...
powershell -Command "Expand-Archive -Path '!PIPER_ZIP!' -DestinationPath '.' -Force"
del "!PIPER_ZIP!"
if exist "piper\piper.exe" (
echo [OK] Piper installed.
) else (
echo [ERROR] Piper extraction failed.
pause & exit /b 1
)
)
:: --- Read voice name from config.lua ---------------------------------------
set "VOICE_NAME=en_US-amy-medium"
if exist "config.lua" (
for /f "tokens=1,* delims==" %%a in ('findstr /R "^PIPER_VOICE" config.lua') do (
set "VRAW=%%b"
for /f "tokens=*" %%v in ("!VRAW!") do set "VRAW=%%v"
set "VRAW=!VRAW:"=!"
set "VRAW=!VRAW:'=!"
for /f "tokens=*" %%v in ("!VRAW!") do set "VOICE_NAME=%%v"
)
)
:: --- Download voice model --------------------------------------------------
echo.
echo [3/4] Setting up voice model (!VOICE_NAME!)...
if exist "piper\voices\!VOICE_NAME!.onnx" (
echo [OK] Voice model already present, skipping.
) else (
mkdir piper\voices 2>nul
:: Parse voice name: en_US-amy-medium → en/en_US/amy/medium
:: tokens=1,2,3 with delims=- gives: en_US, amy, medium
for /f "tokens=1,2,3 delims=-" %%a in ("!VOICE_NAME!") do (
set "V_LANG=%%a"
set "V_SPEAKER=%%b"
set "V_QUALITY=%%c"
)
:: Extract language prefix (e.g. en from en_US)
for /f "tokens=1 delims=_" %%l in ("!V_LANG!") do set "V_LANGPRE=%%l"
set "VOICE_URL=https://huggingface.co/rhasspy/piper-voices/resolve/main/!V_LANGPRE!/!V_LANG!/!V_SPEAKER!/!V_QUALITY!"
echo Downloading voice model from HuggingFace...
echo URL: !VOICE_URL!
powershell -Command "Invoke-WebRequest -Uri '!VOICE_URL!/!VOICE_NAME!.onnx' -OutFile 'piper\voices\!VOICE_NAME!.onnx' -UseBasicParsing"
powershell -Command "Invoke-WebRequest -Uri '!VOICE_URL!/!VOICE_NAME!.onnx.json' -OutFile 'piper\voices\!VOICE_NAME!.onnx.json' -UseBasicParsing"
if exist "piper\voices\!VOICE_NAME!.onnx" (
echo [OK] Voice model downloaded.
) else (
echo [ERROR] Voice model download failed.
pause & exit /b 1
)
)
:: --- Create config files ----------------------------------------------------
echo.
echo [4/5] Setting up config files...
if exist ".env" (
echo [OK] .env already exists, skipping.
) else (
copy ".env.example" ".env" >nul
echo [OK] .env created from .env.example — add your API key before starting.
)
if exist "config.local.lua" (
echo [OK] config.local.lua already exists, skipping.
) else (
copy "config.local.lua.example" "config.local.lua" >nul
echo [OK] config.local.lua created from example — edit to set your airfield and frequencies.
)
:: --- Build exe -------------------------------------------------------------
echo.
echo [5/5] Building ATC Bot.exe...
python -m pip install pyinstaller --quiet
pyinstaller --onefile --console --name "ATC Bot" --icon=atcicon.ico launcher.py --distpath dist --workpath build --noconfirm
if errorlevel 1 (
echo [WARN] PyInstaller build failed — you can still run: python main.py
goto :skipcopy
)
if exist "dist\ATC Bot.exe" (
copy /y "dist\ATC Bot.exe" "ATC Bot.exe" >nul
echo [OK] ATC Bot.exe created.
) else (
echo [WARN] Built exe not found — you can still run: python main.py
)
:skipcopy
:: --- Done ------------------------------------------------------------------
echo.
echo ============================================================
echo Installation complete.
echo.
echo Next steps:
echo 1. Edit .env and add your API key (OPENAI_API_KEY or GROQ_API_KEY)
echo 2. Edit config.local.lua to set your airfield and frequencies
echo 3. Install dcs_atc_export.lua into DCS Saved Games\Scripts\Hooks\
echo 4. Run: "ATC Bot.exe" or python main.py
echo ============================================================
echo.
pause