@echo off REM 🚀 YouTube Metadata Extractor - Windows Deployment (Batch) REM Simple deployment script for Windows echo 🚀 Starting deployment of YouTube Metadata Extractor on Windows... REM Check if running as Administrator net session >nul 2>&1 if %errorLevel% == 0 ( echo ✅ Running as Administrator ) else ( echo ❌ This script must be run as Administrator echo Please right-click this file and select "Run as administrator" pause exit /b 1 ) REM Set configuration set PROJECT_DIR=%USERPROFILE%\YouTube set REPO_URL=https://huggingface.co/spaces/dzianisBY/YouTube_Creator_MetaData echo ✅ Installing Chocolatey (if not present)... where choco >nul 2>&1 if %errorLevel% == 0 ( echo Chocolatey already installed ) else ( powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" call refreshenv ) echo ✅ Installing Python and Git... choco install python git -y call refreshenv echo ✅ Creating project directory... if not exist "%PROJECT_DIR%" mkdir "%PROJECT_DIR%" cd /d "%PROJECT_DIR%" echo ✅ Cloning repository... if exist ".git" ( git pull origin main ) else ( git clone %REPO_URL% . ) echo ✅ Setting up Python virtual environment... python -m venv .venv call .venv\Scripts\activate.bat echo ✅ Installing Python dependencies... python -m pip install --upgrade pip pip install -r requirements.txt pip install -r telegram_requirements.txt echo ✅ Creating .env template... if not exist ".env" ( echo # YouTube API Configuration > .env echo YOUTUBE_API_KEY=your_youtube_api_key_here >> .env echo. >> .env echo # Telegram Bot Configuration >> .env echo TELEGRAM_TOKEN=your_telegram_bot_token_here >> .env echo. >> .env echo # MCP Server Configuration >> .env echo MCP_BASE_URL=https://youtube-bot.tuttech.net/api/mcp >> .env echo. >> .env echo # Gemini AI Configuration >> .env echo GEMINI_API_KEY=your_gemini_api_key_here >> .env echo. >> .env echo # Server Configuration >> .env echo HOST=0.0.0.0 >> .env echo PORT=8080 >> .env echo ⚠️ Created .env template file echo ⚠️ Please edit %PROJECT_DIR%\.env with your actual API keys! ) echo ✅ Creating startup scripts... echo @echo off > start-api.bat echo cd /d "%PROJECT_DIR%" >> start-api.bat echo call .venv\Scripts\activate.bat >> start-api.bat echo python main.py >> start-api.bat echo @echo off > start-bot.bat echo cd /d "%PROJECT_DIR%" >> start-bot.bat echo call .venv\Scripts\activate.bat >> start-bot.bat echo python run_telegram_bot.py >> start-bot.bat echo ✅ Installing NSSM for Windows Services... choco install nssm -y echo ✅ Creating Windows Services... nssm remove "YouTube-API" confirm >nul 2>&1 nssm remove "YouTube-Bot" confirm >nul 2>&1 nssm install "YouTube-API" "%PROJECT_DIR%\start-api.bat" nssm set "YouTube-API" DisplayName "YouTube MCP API Server" nssm set "YouTube-API" Description "YouTube Metadata Extractor API Server" nssm set "YouTube-API" Start SERVICE_AUTO_START nssm install "YouTube-Bot" "%PROJECT_DIR%\start-bot.bat" nssm set "YouTube-Bot" DisplayName "YouTube Telegram Bot" nssm set "YouTube-Bot" Description "YouTube Metadata Extractor Telegram Bot" nssm set "YouTube-Bot" Start SERVICE_AUTO_START nssm set "YouTube-Bot" DependOnService "YouTube-API" echo ✅ Starting services... net start "YouTube-API" timeout /t 5 /nobreak >nul net start "YouTube-Bot" echo ✅ Configuring Windows Firewall... netsh advfirewall firewall add rule name="YouTube API Server" dir=in action=allow protocol=TCP localport=8080 >nul 2>&1 echo. echo ✅ Deployment completed! echo. echo 📋 Next steps: echo 1. Edit %PROJECT_DIR%\.env with your API keys echo 2. Restart services: net stop "YouTube-API" "YouTube-Bot" ^& net start "YouTube-API" "YouTube-Bot" echo 3. Check services: sc query "YouTube-API" ^& sc query "YouTube-Bot" echo. echo 🔗 Service URLs: echo - API Server: http://localhost:8080 echo - Health Check: http://localhost:8080/health echo. echo 📱 Service Management: echo - Start: net start "YouTube-API" "YouTube-Bot" echo - Stop: net stop "YouTube-API" "YouTube-Bot" echo - Status: sc query "YouTube-API" ^& sc query "YouTube-Bot" echo. pause