fix: Windows-safe DB_PATH via env var, add Windows installer scripts
This commit is contained in:
116
WINDOWS_BUILD_README.md
Normal file
116
WINDOWS_BUILD_README.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# BatchTube Windows Build Guide
|
||||
Intentures LLC | https://batchtube.com | v1.0.0
|
||||
|
||||
## Files In This Package
|
||||
|
||||
| File | Location | Purpose |
|
||||
|------|----------|---------|
|
||||
| batchtube-launcher.py | backend/ | Windows entry point - starts FastAPI + opens browser |
|
||||
| batchtube-windows.spec | backend/ | PyInstaller spec - single-file EXE with all deps |
|
||||
| version_info.txt | backend/ | Windows EXE metadata |
|
||||
| installer.nsi | project root | NSIS installer script |
|
||||
| build_windows.bat | project root | One-click build script |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.11+ (64-bit) - https://python.org/downloads
|
||||
- NSIS 3.x - https://nsis.sourceforge.io/
|
||||
- Git - https://git-scm.com
|
||||
|
||||
## Quick Build
|
||||
|
||||
Double-click build_windows.bat - it handles everything:
|
||||
1. Creates virtual environment
|
||||
2. Installs all Python dependencies
|
||||
3. Downloads yt-dlp.exe
|
||||
4. Runs PyInstaller -> backend/dist/BatchTube.exe
|
||||
5. Runs NSIS -> BatchTube-Setup-1.0.0.exe
|
||||
|
||||
## Manual Build Steps
|
||||
|
||||
### Step 1 - Get Source
|
||||
|
||||
scp -r root@212.28.188.26:/root/batchtube-tauri ./batchtube
|
||||
cd batchtube
|
||||
|
||||
### Step 2 - Fix config.py DB Path
|
||||
|
||||
Edit backend/config.py - replace the DB_PATH line:
|
||||
|
||||
# Before:
|
||||
DB_PATH = os.path.join(os.path.dirname(__file__), "youtube_sipoc.db")
|
||||
|
||||
# After:
|
||||
DB_PATH = os.environ.get(
|
||||
'BATCHTUBE_DB_PATH',
|
||||
os.path.join(os.path.dirname(__file__), "youtube_sipoc.db")
|
||||
)
|
||||
|
||||
### Step 3 - Install Dependencies
|
||||
|
||||
cd backend
|
||||
python -m venv venv
|
||||
venv\Scripts\activate
|
||||
pip install -r requirements.txt
|
||||
pip install pyinstaller
|
||||
|
||||
### Step 4 - Download yt-dlp
|
||||
|
||||
mkdir ..\tools
|
||||
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -o ..\tools\yt-dlp.exe
|
||||
|
||||
### Step 5 - Build EXE
|
||||
|
||||
pyinstaller batchtube-windows.spec --clean
|
||||
# Output: backend/dist/BatchTube.exe
|
||||
|
||||
### Step 6 - Test EXE
|
||||
|
||||
dist\BatchTube.exe
|
||||
# Browser should open to http://127.0.0.1:8765
|
||||
|
||||
### Step 7 - Build Installer
|
||||
|
||||
cd ..
|
||||
makensis installer.nsi
|
||||
# Output: BatchTube-Setup-1.0.0.exe
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Problem | Fix |
|
||||
|---------|-----|
|
||||
| ModuleNotFoundError at runtime | Add to hiddenimports in batchtube-windows.spec |
|
||||
| Web UI 404 | Check datas path ('web','backend/web') in spec |
|
||||
| DB crash on launch | Apply config.py DB_PATH fix in Step 2 |
|
||||
| App closes instantly | Set console=True in spec temporarily to see errors |
|
||||
| SmartScreen warning | Code-sign BatchTube.exe with a Windows cert |
|
||||
|
||||
## After Install
|
||||
|
||||
| Path | Contents |
|
||||
|------|----------|
|
||||
| C:\Program Files\BatchTube\BatchTube.exe | Application |
|
||||
| %APPDATA%\BatchTube\batchtube.db | SQLite database |
|
||||
| Start Menu -> BatchTube | Launch shortcut |
|
||||
| Desktop | Launch shortcut |
|
||||
|
||||
## GitHub Actions - Automated Windows Build
|
||||
|
||||
Add to .github/workflows/build.yml:
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with: { python-version: '3.11' }
|
||||
- run: pip install -r backend/requirements.txt pyinstaller
|
||||
- run: cd backend && pyinstaller batchtube-windows.spec --clean
|
||||
- run: choco install nsis -y && makensis installer.nsi
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BatchTube-Windows
|
||||
path: BatchTube-Setup-*.exe
|
||||
|
||||
---
|
||||
Generated 2026-03-07 by Agent Developer - Intentures LLC
|
||||
Reference in New Issue
Block a user