@echo off setlocal enabledelayedexpansion set "PYTHON_DIR=%~dp0ChatterBox\venv" set "PS_EXE=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" :main_menu cls echo ======================================================== echo Chatterbox-TTS-Server-Multilingual Main Menu echo ======================================================== echo 1. Start Chatterbox-TTS-Server-Multilingual echo 2. Install/Reinstall Chatterbox-TTS-Server-Multilingual echo 3. Update Chatterbox-TTS-Server-Multilingual echo ======================================================== echo By @li_aeron 2025 echo ======================================================== set /p choice=Choose action 1-3: if "%choice%"=="1" goto start_chatterbox if "%choice%"=="2" goto install_chatterbox if "%choice%"=="3" goto update_chatterbox echo Wrong choice. Please, try again. pause goto main_menu :install_chatterbox cls echo ========================================================== echo Preparing installation... echo ========================================================== set "CACHE_DIR=%~dp0ChatterBox\.cache" set "INSTALL_DIR=%~dp0ChatterBox" set "SEVENZIP_EXE=%CACHE_DIR%\7zr.exe" set "ARCHIVE_FILE=%CACHE_DIR%\CBTTSSRVSR.7z" set "SEVENZIP_URL=https://huggingface.co/datasets/LeeAeron/ffmpeg_for_ai/resolve/main/7zr.exe?download=true" set "ARCHIVE_URL=https://huggingface.co/datasets/LeeAeron/Chatterbox-TTS-Server-Multilingual/resolve/main/CBTTSSRVSR.7z?download=true" if exist "%INSTALL_DIR%" ( echo ========================================================== echo Previous installation detected in "%INSTALL_DIR%" echo ========================================================== choice /M "Do you want to remove the existing installation?" if errorlevel 2 ( echo Keeping existing installation. Returning to main menu... pause goto main_menu ) echo Removing previous installation except "model_cache"... for /d %%D in ("%INSTALL_DIR%\*") do ( if /I not "%%~nxD"=="model_cache" ( rmdir /s /q "%%D" ) ) del /q "%INSTALL_DIR%\*" ) mkdir "%INSTALL_DIR%" if not exist "%CACHE_DIR%" mkdir "%CACHE_DIR%" if not exist "%SEVENZIP_EXE%" ( echo Downloading 7-Zip extractor... "%PS_EXE%" -NoProfile -Command "Invoke-WebRequest -Uri '%SEVENZIP_URL%' -OutFile '%SEVENZIP_EXE%'" ) if not exist "%ARCHIVE_FILE%" ( echo Downloading Chatterbox installer archive... "%PS_EXE%" -NoProfile -Command "Invoke-WebRequest -Uri '%ARCHIVE_URL%' -OutFile '%ARCHIVE_FILE%'" ) echo Extracting archive... "%SEVENZIP_EXE%" x "%ARCHIVE_FILE%" -o"%INSTALL_DIR%" -y set "PSFILE=%INSTALL_DIR%\install\setup.ps1" if not exist "%PSFILE%" ( echo ERROR: setup.ps1 not found at %PSFILE% echo Listing contents of %INSTALL_DIR% for debugging: dir /b /s "%INSTALL_DIR%" pause goto main_menu ) pushd "%~dp0ChatterBox" echo ========================================================== echo Launching Installation echo ========================================================== "%PS_EXE%" -NoProfile -ExecutionPolicy Bypass -Command "Set-Location '%~dp0ChatterBox'; & '%~dp0ChatterBox\install\setup.ps1'" set "ERR=%ERRORLEVEL%" popd "%PS_EXE%" -NoProfile -ExecutionPolicy Bypass -File "%PSFILE%" set "ERR=%ERRORLEVEL%" if "%ERR%"=="99" goto main_menu if "%ERR%"=="1" ( echo ========================================================== echo An error occurred during installation. echo Please check the messages above for more details. echo ========================================================== pause goto main_menu ) echo Installation completed successfully! pause goto main_menu :update_chatterbox cls echo ========================================================== echo Updating installation... echo ========================================================== set "CACHE_DIR=%~dp0ChatterBox\.cache" set "INSTALL_DIR=%~dp0ChatterBox" set "SEVENZIP_EXE=%CACHE_DIR%\7zr.exe" set "UPDATE_ARCHIVE=%CACHE_DIR%\CBTTSSRVSR_UPDATE.7z" set "UPDATE_URL=https://huggingface.co/datasets/LeeAeron/Chatterbox-TTS-Server-Multilingual/resolve/main/CBTTSSRVSR_UPDATE.7z?download=true" if not exist "%CACHE_DIR%" mkdir "%CACHE_DIR%" if not exist "%SEVENZIP_EXE%" ( echo Downloading 7-Zip extractor... "%PS_EXE%" -NoProfile -Command "Invoke-WebRequest -Uri 'https://huggingface.co/datasets/LeeAeron/ffmpeg_for_ai/resolve/main/7zr.exe?download=true' -OutFile '%SEVENZIP_EXE%'" ) echo Downloading update archive... "%PS_EXE%" -NoProfile -Command "Invoke-WebRequest -Uri '%UPDATE_URL%' -OutFile '%UPDATE_ARCHIVE%'" echo Extracting update archive... "%SEVENZIP_EXE%" x "%UPDATE_ARCHIVE%" -o"%INSTALL_DIR%" -y set "UPDATE_SCRIPT=%INSTALL_DIR%\install\update_ruaccent.ps1" if exist "%UPDATE_SCRIPT%" ( echo Running update script... "%PS_EXE%" -NoProfile -ExecutionPolicy Bypass -File "%UPDATE_SCRIPT%" set "ERR=%ERRORLEVEL%" >nul set /p "= "