Files
transcriber/windows.bat
T
truetype 76946f8594 Refactor app to speech-only transcription tool
Remove image generation, text-to-speech, and chat features.
Keep speech transcription with Whisper.cpp, model manager, and settings.
Support multiple audio formats (WAV, MP3, M4A, OGG, FLAC, WebM, AAC)
via ffmpeg transcoding. Single-call API: upload → transcribe → download
as txt/json/md.
2026-09-16 20:17:09 +02:00

101 lines
3.5 KiB
Batchfile

@echo off
title Speech Transcriber
cd /d "%~dp0"
set APP=%~dp0app
set NODE=%APP%\tools\node-win\node.exe
set NPM=%APP%\tools\node-win\npm.cmd
set DIST=%APP%\dist\index.html
set SETUP=%~dp0scripts\setup\setup.ps1
set SPEECH_BACKEND=%APP%\speech-backend\win\cpu\whisper-cli.exe
set SPEECH_BACKEND_VULKAN=%APP%\speech-backend\win\vulkan\whisper-cli.exe
set SPEECH_BACKEND_CUDA=%APP%\speech-backend\win\cuda\whisper-cli.exe
set SERVE=%~dp0scripts\server\serve.cjs
if "%FRONTEND_PORT%"=="" set FRONTEND_PORT=1420
set SETUP_REASON=
set SETUP_MODE=Repair
:: ── First-time setup check ────────────────────────────────────────────────────
if not exist "%APP%\tools\node-win" set SETUP_MODE=First-Time Setup
if not exist "%NODE%" (
set SETUP_REASON=Portable Node.js is missing.
goto :run_setup
)
if not exist "%NPM%" (
set SETUP_REASON=Portable npm is missing.
goto :run_setup
)
if not exist "%DIST%" (
set SETUP_REASON=Frontend build is missing.
goto :run_setup
)
if not exist "%SPEECH_BACKEND%" (
if not exist "%SPEECH_BACKEND_VULKAN%" (
if not exist "%SPEECH_BACKEND_CUDA%" (
set SETUP_REASON=whisper.cpp speech backend is missing.
goto :run_setup
)
)
)
goto :launch
:run_setup
echo.
echo ============================================================
echo SPEECH TRANSCRIBER ^| %SETUP_MODE%
echo ============================================================
echo.
if "%SETUP_MODE%"=="First-Time Setup" (
echo This looks like your first run. Setting up automatically...
) else (
echo Speech Transcriber needs a quick repair before launch.
)
if not "%SETUP_REASON%"=="" echo Reason: %SETUP_REASON%
echo Whisper models are not downloaded during setup. Download or import them in the app.
echo.
echo Press any key to continue, or Ctrl+C to cancel.
pause >nul
:: Clear old frontend and backend server processes before setup so app/tools/node-win can be replaced
for /f "tokens=5" %%a in ('netstat -aon 2^>nul ^| findstr ":%FRONTEND_PORT% "') do taskkill /f /pid %%a >nul 2>nul
powershell -ExecutionPolicy Bypass -File "%SETUP%"
if errorlevel 1 (
echo.
echo [ERROR] Setup failed. Please check the output above.
pause
exit /b 1
)
:: After setup, continue to launch
goto :launch
:: ── Launch ────────────────────────────────────────────────────────────────────
:launch
echo.
echo ============================================================
echo SPEECH TRANSCRIBER ^| Launching...
echo ============================================================
echo.
:: Clear frontend port to prevent address conflicts.
echo Clearing frontend port %FRONTEND_PORT%...
for /f "tokens=5" %%a in ('netstat -aon 2^>nul ^| findstr ":%FRONTEND_PORT% "') do taskkill /f /pid %%a >nul 2>nul
:: Start frontend server + backend manager
echo Starting Speech Transcriber...
echo Opening browser at http://localhost:%FRONTEND_PORT%...
start /b cmd /c "timeout /t 2 >nul && start http://localhost:%FRONTEND_PORT%"
echo.
echo ============================================================
echo Running!
echo Web UI: http://localhost:%FRONTEND_PORT%
echo Speech: Managed locally by the app (whisper.cpp)
echo.
echo Press Ctrl+C in this window to stop all services.
echo ============================================================
echo.
"%NODE%" "%SERVE%"