diff --git a/WINDOWS.md b/WINDOWS.md new file mode 100644 index 00000000..5cc9c9e1 --- /dev/null +++ b/WINDOWS.md @@ -0,0 +1,66 @@ +# Strudel (fork hacklab) + KISUM en Windows + +> ⚠ **Estado: a probar.** Estos scripts están escritos y revisados pero +> todavía no se han ejecutado en un Windows real. Si algo falla, abre una +> incidencia en el Gitea con el error. + +## Requisitos + +Instálalos una vez (desde PowerShell o `winget`): + +```powershell +winget install OpenJS.NodeJS.LTS # Node.js (>=20) + npm/corepack +winget install Python.Python.3.12 # Python (para KISUM) +winget install Gyan.FFmpeg # ffmpeg (para leer vídeo en KISUM) +``` + +Cierra y reabre la terminal después, para que el `PATH` se actualice. + +## Instalación (un comando) + +Descarga el repo y ejecuta el instalador: + +```powershell +git clone https://gitea.laenre.net/hacklab/strudel.git +cd strudel +powershell -ExecutionPolicy Bypass -File .\install.ps1 +``` + +Instala las dependencias de Node (`pnpm`), construye la web y crea el entorno +de KISUM. **No** guarda paquetes en el repo (todo va a carpetas ignoradas). + +## Uso + +```powershell +powershell -ExecutionPolicy Bypass -File .\strudel-launcher.ps1 +``` + +Abre en el navegador y arranca el servidor de KISUM +(). Para KISUM desde la terminal: + +```powershell +cd kisum +.\kisum.cmd tu_cancion.mp3 +.\kisum.cmd clip.mp4 --bars 8 --bass +``` + +### Acceso directo en el escritorio + +Crea un acceso directo cuyo destino sea: + +``` +powershell -ExecutionPolicy Bypass -File "C:\ruta\a\strudel\strudel-launcher.ps1" +``` + +## Notas + +- Si PowerShell bloquea los scripts, ejecútalos con `-ExecutionPolicy Bypass` + como en los ejemplos (no cambia la política global del sistema). +- El resto (funciones, pestañas KISUM/Visor, temas…) es idéntico a Linux; solo + cambian los lanzadores. Ver [`README.md`](./README.md). + +## Fase 2 (futuro): instalador .exe + +Empaquetar todo en un instalador `.exe` con **Inno Setup** o **NSIS** (que +instale Node/Python/ffmpeg embebidos y cree los accesos directos) es posible, +pero hay que compilarlo y probarlo en Windows. Queda propuesto. diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 00000000..f3dd16e9 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,55 @@ +# Instalador de Strudel (fork hacklab) + KISUM para Windows (PowerShell). +# Ejecuta desde una terminal PowerShell en la carpeta del repo: +# powershell -ExecutionPolicy Bypass -File .\install.ps1 +# +# NO sube paquetes al repo: usa pnpm (Node) y un venv de Python para KISUM. +# ⚠ Escrito y revisado, pero pendiente de probar en un Windows real. +$ErrorActionPreference = "Stop" +$DIR = Split-Path -Parent $MyInvocation.MyCommand.Path +Set-Location $DIR + +Write-Host "============================================" +Write-Host " Instalador Strudel (fork hacklab) + KISUM" +Write-Host "============================================" + +# --- Node / pnpm --- +if (-not (Get-Command node -ErrorAction SilentlyContinue)) { + Write-Error "Falta Node.js (>= 20). Instálalo: winget install OpenJS.NodeJS.LTS (y reabre la terminal)" +} +if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) { + Write-Host "==> activando pnpm con corepack" + corepack enable pnpm +} + +Write-Host "==> Strudel: instalando dependencias de Node (pnpm i)..." +pnpm i +Write-Host "==> Strudel: construyendo la web (pnpm build)..." +pnpm build + +# --- KISUM (opcional) --- +$kisum = Join-Path $DIR "kisum" +if (Test-Path (Join-Path $kisum "requirements.txt")) { + Write-Host "==> Configurando KISUM (audio -> codigo Strudel)..." + $venv = Join-Path $kisum ".venv" + if (Get-Command py -ErrorAction SilentlyContinue) { + py -3 -m venv $venv + } elseif (Get-Command python -ErrorAction SilentlyContinue) { + python -m venv $venv + } else { + Write-Warning "No encuentro Python. Instálalo: winget install Python.Python.3.12 (KISUM no se instalará; Strudel funciona igual)" + $venv = $null + } + if ($venv) { + $pip = Join-Path $venv "Scripts\pip.exe" + & $pip install --upgrade pip + & $pip install -r (Join-Path $kisum "requirements.txt") + if (-not (Get-Command ffmpeg -ErrorAction SilentlyContinue)) { + Write-Warning "ffmpeg no está en el PATH. KISUM lo necesita para vídeo. Instálalo: winget install Gyan.FFmpeg (y reabre la terminal)" + } + } +} + +Write-Host "" +Write-Host "OK. Arranca con: powershell -ExecutionPolicy Bypass -File .\strudel-launcher.ps1" +Write-Host " Strudel: http://127.0.0.1:3009" +Write-Host " KISUM server: http://127.0.0.1:3010 (arranca solo con el lanzador)" diff --git a/kisum/kisum.cmd b/kisum/kisum.cmd new file mode 100644 index 00000000..6e6d232b --- /dev/null +++ b/kisum/kisum.cmd @@ -0,0 +1,12 @@ +@echo off +rem Lanzador de KISUM para Windows: usa el venv local de esta carpeta. +rem kisum tu_cancion.mp3 +rem kisum clip.mp4 --bars 8 --bass +setlocal +set "DIR=%~dp0" +if not exist "%DIR%.venv\Scripts\python.exe" ( + echo KISUM: no encuentro el entorno .venv + echo Instalalo con: powershell -ExecutionPolicy Bypass -File ..\install.ps1 + exit /b 1 +) +"%DIR%.venv\Scripts\python.exe" "%DIR%kisum.py" %* diff --git a/strudel-launcher.ps1 b/strudel-launcher.ps1 new file mode 100644 index 00000000..c6f024fb --- /dev/null +++ b/strudel-launcher.ps1 @@ -0,0 +1,34 @@ +# Lanzador de Strudel (fork hacklab) + KISUM para Windows (PowerShell). +# powershell -ExecutionPolicy Bypass -File .\strudel-launcher.ps1 +# Sirve la build estática, arranca el servidor de KISUM y abre el navegador. +# ⚠ Escrito y revisado, pero pendiente de probar en un Windows real. +$DIR = Split-Path -Parent $MyInvocation.MyCommand.Path +$PORT = if ($env:STRUDEL_PORT) { $env:STRUDEL_PORT } else { 3009 } +$URL = "http://127.0.0.1:$PORT/" +$ASTRO = Join-Path $DIR "website\node_modules\.bin\astro.cmd" + +function Test-Up($u) { + try { Invoke-WebRequest -UseBasicParsing -Uri $u -TimeoutSec 2 | Out-Null; return $true } catch { return $false } +} + +if (-not (Test-Path $ASTRO)) { + Write-Error "Falta la instalación. Ejecuta antes: powershell -ExecutionPolicy Bypass -File .\install.ps1" +} + +# --- Servidor web (astro preview) --- +if (-not (Test-Up $URL)) { + Start-Process -WindowStyle Hidden -WorkingDirectory (Join-Path $DIR "website") ` + -FilePath $ASTRO -ArgumentList "preview","--port","$PORT","--host","127.0.0.1" + for ($i = 0; $i -lt 30; $i++) { if (Test-Up $URL) { break }; Start-Sleep -Seconds 1 } +} + +# --- Servidor KISUM (si tiene venv) --- +$KPY = Join-Path $DIR "kisum\.venv\Scripts\python.exe" +if (Test-Path $KPY) { + if (-not (Test-Up "http://127.0.0.1:3010/health")) { + Start-Process -WindowStyle Hidden -FilePath $KPY -ArgumentList (Join-Path $DIR "kisum\kisum_server.py") + } +} + +# --- Abrir navegador --- +Start-Process $URL