mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
feat: bundle FFmpeg via ffmpeg-static for one-click deployment
Users no longer need to install FFmpeg separately — it is now bundled as an npm dependency (ffmpeg-static). player.ts resolves the bundled binary automatically and falls back to system PATH. start.bat and a new setup.bat script handle dependency installation and project building. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
00231db0cb
commit
61d9bbe0b7
5 files changed
+1033
-17
No files matched your search
+24
-16
@@ -6,34 +6,42 @@ echo.
|
||||
:: Check if node is available
|
||||
where node >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo Node.js is not installed. Please install Node.js 20 LTS from https://nodejs.org
|
||||
echo Node.js is not installed.
|
||||
echo Run scripts\setup.bat for automatic installation, or install Node.js 20+ from https://nodejs.org
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Check if ffmpeg is available
|
||||
where ffmpeg >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo FFmpeg not found in PATH. Checking local directory...
|
||||
if exist "%~dp0ffmpeg\ffmpeg.exe" (
|
||||
set PATH=%~dp0ffmpeg;%PATH%
|
||||
echo Using bundled FFmpeg.
|
||||
) else (
|
||||
echo FFmpeg is required. Please install FFmpeg or place it in the ffmpeg\ directory.
|
||||
:: Resolve project root (one level up from scripts/)
|
||||
cd /d "%~dp0.."
|
||||
|
||||
:: Install dependencies if needed
|
||||
if not exist "node_modules" (
|
||||
echo Installing dependencies...
|
||||
call npm install --production
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to install dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
:: Install dependencies if needed
|
||||
if not exist "%~dp0node_modules" (
|
||||
echo Installing dependencies...
|
||||
cd /d "%~dp0"
|
||||
call npm install --production
|
||||
:: Build if dist/ doesn't exist
|
||||
if not exist "dist" (
|
||||
echo Building project...
|
||||
call npx tsc
|
||||
if %errorlevel% neq 0 (
|
||||
echo Build failed.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
:: FFmpeg is bundled via ffmpeg-static — no PATH check needed.
|
||||
echo FFmpeg is bundled via node_modules (ffmpeg-static).
|
||||
echo.
|
||||
|
||||
:: Start the application
|
||||
cd /d "%~dp0"
|
||||
node dist/index.js
|
||||
|
||||
pause
|
||||
Reference in new issue
Block a user