Opdateringer

This commit is contained in:
2026-04-15 16:30:03 +02:00
parent 4a206f2f19
commit 920cd8222d
8 changed files with 1163 additions and 251 deletions

View File

@@ -1,35 +1,123 @@
@echo off
echo === LineDance Player - Windows Build ===
setlocal enabledelayedexpansion
echo.
echo ================================================
echo LineDance Player - Windows Build + Installer
echo ================================================
echo.
:: ── Aktiver venv ──────────────────────────────────────────────────────────────
if exist "venv\Scripts\activate.bat" (
call venv\Scripts\activate.bat
) else (
echo ADVARSEL: venv ikke fundet
echo ADVARSEL: venv ikke fundet - bruger system Python
)
pip install pyinstaller >nul 2>&1
:: ── Tjek Python ───────────────────────────────────────────────────────────────
python --version >nul 2>&1
if errorlevel 1 (
echo FEJL: Python ikke fundet
pause & exit /b 1
)
if exist "dist\LineDancePlayer" rmdir /s /q "dist\LineDancePlayer"
if exist "build\LineDancePlayer" rmdir /s /q "build\LineDancePlayer"
:: ── Installer/opdater PyInstaller ─────────────────────────────────────────────
echo [1/4] Installerer PyInstaller...
pip install pyinstaller --quiet
echo Bygger... (1-3 minutter)
:: ── Ryd gamle builds ──────────────────────────────────────────────────────────
echo [2/4] Rydder gamle builds...
if exist "dist\LineDancePlayer" rmdir /s /q "dist\LineDancePlayer"
if exist "build\LineDancePlayer" rmdir /s /q "build\LineDancePlayer"
:: ── PyInstaller build ─────────────────────────────────────────────────────────
echo [3/4] Bygger med PyInstaller (2-5 minutter)...
echo.
pyinstaller build_windows.spec --clean --noconfirm
if errorlevel 1 (
echo.
echo FEJL: Se fejlbesked ovenfor
pause
exit /b 1
echo FEJL: PyInstaller fejlede - se fejlbesked ovenfor
pause & exit /b 1
)
echo.
echo === FAERDIG ===
echo Program: dist\LineDancePlayer\LineDancePlayer.exe
echo OK: dist\LineDancePlayer\ er klar
echo.
echo HUSK: Kopieer hele dist\LineDancePlayer\ mappen - ikke kun .exe!
echo HUSK: VLC skal vaere installeret paa maskinen.
:: ── NSIS installer ────────────────────────────────────────────────────────────
echo [4/4] Bygger NSIS installer...
echo.
:: Find NSIS
set "NSIS="
if exist "C:\Program Files (x86)\NSIS\makensis.exe" set "NSIS=C:\Program Files (x86)\NSIS\makensis.exe"
if exist "C:\Program Files\NSIS\makensis.exe" set "NSIS=C:\Program Files\NSIS\makensis.exe"
if not defined NSIS (
echo ADVARSEL: NSIS ikke fundet.
echo.
echo Download NSIS fra https://nsis.sourceforge.io/Download
echo og koer derefter: makensis installer.nsi
echo.
echo PyInstaller-buildet ligger klar i dist\LineDancePlayer\
goto :done
)
:: Tjek installer-mappe og billeder
if not exist "installer" mkdir installer
:: Generer et simpelt .ico hvis det mangler (kræver PowerShell)
if not exist "installer\icon.ico" (
echo Genererer standard ikon...
powershell -NoProfile -Command ^
"$bmp = New-Object System.Drawing.Bitmap(64,64); " ^
"$g = [System.Drawing.Graphics]::FromImage($bmp); " ^
"$g.Clear([System.Drawing.Color]::FromArgb(14,15,17)); " ^
"$b = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(232,160,32)); " ^
"$g.FillEllipse($b, 8, 8, 48, 48); " ^
"$bmp.Save('installer\icon.png'); " ^
"$g.Dispose(); $bmp.Dispose()" 2>nul
echo (Sæt et rigtigt icon.ico i installer\ for bedre resultat)
)
:: Byg NSIS — uden ikon-linjer hvis .ico mangler
if exist "installer\icon.ico" (
"%NSIS%" /V2 installer.nsi
) else (
:: Lav midlertidig .nsi uden ikon
powershell -NoProfile -Command ^
"(Get-Content installer.nsi) | " ^
"Where-Object { $_ -notmatch 'MUI_ICON|MUI_UNICON|MUI_HEADERIMAGE' } | " ^
"Set-Content installer_tmp.nsi"
"%NSIS%" /V2 installer_tmp.nsi
del installer_tmp.nsi
)
if errorlevel 1 (
echo.
echo FEJL: NSIS fejlede - se fejlbesked ovenfor
pause & exit /b 1
)
:done
echo.
echo ================================================
echo FAERDIG!
echo ================================================
if exist "dist\LineDancePlayer-Setup.exe" (
echo.
echo Installer: dist\LineDancePlayer-Setup.exe
for %%A in ("dist\LineDancePlayer-Setup.exe") do (
set /a SIZEMB=%%~zA / 1048576
echo Stoerrelse: !SIZEMB! MB
)
echo.
echo Upload til server:
echo scp dist\LineDancePlayer-Setup.exe bruger@linedanceplayer.dk:/opt/docker/linedanceafspiller/linedance-api/web/public/download/
) else (
echo.
echo PyInstaller-build: dist\LineDancePlayer\
echo Kør makensis installer.nsi manuelt naar NSIS er installeret
)
echo.
pause